Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional and variadic function arguments #16

Open
mbeckem opened this issue May 22, 2021 · 0 comments
Open

Optional and variadic function arguments #16

mbeckem opened this issue May 22, 2021 · 0 comments
Labels
idea Proposals that have not been committed to yet language feature Requires changes to the language's grammar or its semantics

Comments

@mbeckem
Copy link
Owner

mbeckem commented May 22, 2021

Currently user defined functions can only specify a fixed number of parameters:

fn foo(a, b, c) { ... }

We should at least support optional function parameters and possibly also variadic functions.

Example syntax for optional parameters:

fn dump(value, pretty = false) { ... }

"?" syntax like in TypeScript (e.g. pretty?) is not a good idea here, i think.
The only fitting default value would be null (i do not want an undefined construct exposed to the language).

@mbeckem mbeckem added language feature Requires changes to the language's grammar or its semantics idea Proposals that have not been committed to yet labels May 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Proposals that have not been committed to yet language feature Requires changes to the language's grammar or its semantics
Projects
None yet
Development

No branches or pull requests

1 participant