-
Notifications
You must be signed in to change notification settings - Fork 229
Description
Trying to nail down the last few cases of wildcards. I'll regurgitate the issues and options that @munificent wrote to me and bring it up for discussion:
In the proposal, it states wildcards apply to local variables and parameters, but not to top-level variables and class members.
In an extension type, the primary constructor syntax looks like a parameter but defines a field. So if you have a parameter there named
_, does it behave like a wildcard or like a field?Likewise, when/if we add general primary constructor syntax, what does a parameter named
_mean?
Options:
-
Yes, the wildcard proposal applies and it gets no name that you can use. Probably not very useful, but consistent with the syntax which does look like a parameter declaration.
-
No, the wildcard proposal does not apply since you're defining a field. You get a field named
_. Probably useful. -
Avoid the situation entirely by making it an error to have a parameter named
_in a primary constructor or extension type.
@dart-lang/language-team It would be good to make a decision on this and pick an outcome. Your input please?