-
Notifications
You must be signed in to change notification settings - Fork 213
Enhanced Object Literals #205
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
The idea seems to be that in a position where a name and value is required, but only a single identifier is provided, treat that identifier as both the name and the value. Dart doesn't really have any positions where that is the case syntactically because the only place we have names and values is named arguments, and there a single expression can also mean a positional argument. We would have to use the static type of the function being called to distinguish whether What we could do instead would be introducing a shorthand syntax like class Something extends Other {
foo(int a, {int bar, int baz, int qux}) => super.foo(a, :bar, :baz, :qux);
} (It's a good syntax, though, which we then can't use for anything else). I think I'd prefer a simple way to forward all arguments over this: class Something extends Other {
foo(int a, {int bar, int baz, int qux}) = super.foo;
} but it's not impossible. |
@lrhn thanks for your answer, I understood. I like shorthand syntax - |
I'd suggest putting the That's because auto-complete naturally write |
I am looking forward to this. I like There are many cases where one simply forward from one constructor to another, and it becomes tedious to repeat |
class Something extends Other {
foo(int a, {int bar, int baz, int qux}) = super.foo;
}
For "all-constructors" cases it would be great. Why couldn't we be still more directly? Like |
It would also be nice for
named parameters
.The text was updated successfully, but these errors were encountered: