forked from mkhan45/RustScript
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or requestsyntaxLanguage design related issuesLanguage design related issues
Description
Functions have a fixed set of defined parameters, but in some cases we might want to give a function any amount of arguments.
There is therefore a need for some argument spread syntax similar to JavaScript or the params keyword in C#.
This would functions with the spread syntax have a minimum airity but no maximum, casting all arguments after the one with the params keyword or spread syntax to a list:
let greet = fn(greeting, ...people) => greeting + fold(fn(result, person) => result + ", " + person, "", people)
greet("Hello", "John", "Peter", "Mike") // "Hello, John, Peter, Mike"Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestsyntaxLanguage design related issuesLanguage design related issues