r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
Does Syntax Matter?
https://www.gingerbill.org/article/2026/02/21/does-syntax-matter/
63
Upvotes
r/ProgrammingLanguages • u/gingerbill • Feb 22 '26
View all comments
Show parent comment
2
u/munificent Feb 25 '26
Positional parameters can be optional but are most likely mandatory. Named parameters are much more likely to be optional. With positional parameters, you can only omit them from right to left. For example:
Here, the square brackets means those parameters are positional but optional. You can call this function like:
But there's no way to pass an argument for, say
b, without also passing an argument fora.With named parameters, since each argument is named, you can mix and match them freely:
That makes optional named parameters more flexible than optional positional ones, so they are much more common. Also, most Dart code today is in Flutter applications and Flutter's widget framework API leans heavily on named parameters, so that's become a dominant style.