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
Default argument values should imply "const" context #575
Comments
It is by design not a constant context: The language team wanted to keep the door open for language extensions whereby default values could be ordinary expressions that would be computed (the tricky part: in which scope?) at invocation. This would turn into a breaking change if we had allowed (You could say that we have also kept the door open for making it a constant context, should that turn out to be more useful.) |
This sounds like it is resolved? |
Well, considered as a language request we could still go two ways: (1) allow more general expressions (e.g., evaluated at each invocation) as default values, in which case it makes sense that this is not a constant context, or (2) decide that we won't do that (so default values must be constant), and then make it a constant context such that I think the proper thing to do would be to move it to the language repo. If a lot of people have a strong preference about this decision then this issue then they can use this issue to make it known. |
If you run this:
...you get an exception (a bad one, currently, see dart-lang/sdk#35683).
I think the fact that only a constant is allowed to be used there should imply a constant context and thus make the "const" redundant and implied.
The text was updated successfully, but these errors were encountered: