Allow omitting parentheses around single identifier argument in function expressions. #6922
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
core-m
type-enhancement
A request for a change that isn't a bug
Projects
It's an edge case, but I often find myself writing
boo.baz((foo) => using(foo))
In this case, omitting the parentheses around the parameter name would make the code easier to type, and actually easier to read in practice (in my opinion, obviously).
I.e., I suggest to allow writing
boo.baz(foo => using(foo)).
This won't work for multiple parameters (or zero), you will need parentheses for that. It may work with a type on the parameter:
...(String foo => using(foo))
That's still parsable and readable.
For function declarations there is no need for this syntax, it's only for inline functions that it makes sense.
(This is apparently also used as "lambda" syntax in C# 3.0).
The text was updated successfully, but these errors were encountered: