-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[Wildcard Variables] Feature Specification #55661
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
Comments
I just checked, and the icky thing I disagree with is disallowing We should allow it. |
I added the rule that We could try to enable So I'd prefer that we keep // Current code. Breaks because `super._` will be an error.
class A {
final int _;
A(this._);
}
class B extends A {
B(super._);
} // Migrated code. No problem, no rename lints, no code outside this library can know.
class A {
final int __;
A(this.__);
}
class B extends A {
B(super.__);
} Other approaches can be used as well, of course. For example, the initializing formal in In the other case, where class OtherB extends A {
OtherB(super._);
} class OtherB extends A {
// ignore: matching_super_parameters
OtherB(super.__);
} In general, we will continue to allow developers to use |
I think we should allow The reasoning that the specification uses the name is meaningless to the user. Can't it just not do that? Yes, yes it can. It's an accident of specification that the name is used, not anything inherent to the feature. It used to be a safe assumption that the name given to the parameter would still be in scope and refer to the same value at the point of the super constructor invocation, so the specification chose to specify the meaning as a desugaring to an invocation that references the parameter variable. That's no longer safe if we allow We can make it work. How we do that is up to us, it shouldn't matter to the user that we wrote a specification for super parameters that wasn't forward compatible. That's our problem, and we should solve it, and allow |
Another thought: Maybe we should treat all of It's a little iffy, because then they should probably work the same in patterns too. And that's an unrelated breaking change. |
I considered that when I was first writing the proposal. Your point about it being inconsistent with patterns is, I think, a good one. Also, we ultimately want to get to a world where people don't use |
Moved all discussions to their own issues. Easier to keep track :) |
Issue for tracking that the feature spec is in progress or is complete.
The working spec is located here: https://github.com/dart-lang/language/blob/main/working/wildcards/feature-specification.md
@eernstg @munificent Can we confirm that the spec is basically complete? Is there anything else we need to discuss or decide on?
Work Items
super._
? language#3792The text was updated successfully, but these errors were encountered: