Allow =
as separator for named parameter default value.
#27559
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
Milestone
We have
foo([x = 42])
andfoo({x: 42})
as the ways to specify default values for parameters.That means that changing your function from a positional parameter to a named parameter is not just changing the
[]
to{}
, you also have to change=
to:
- but it still means exactly the same thing (default value). This breaks the rule about similar things having similar syntax.Even without changing from one type of parameter to another, I still regularly write
=
for named parameters. There is simply nothing to remind me that it's not=
.It might be cute that it 1) looks like a map or 2) looks like how the function is called, but the former is only true in trivial cases and the latter isn't helping anyway - it's not like positional parameter default values looks like arguments in a function call.
=
as separator for named parameter default value. #27634)=
as separator for named parameter default value #27635)=
as separator for named parameter default value #27636)=
as separator for named parameter default value #27637)The text was updated successfully, but these errors were encountered: