DIP 1019--Named Arguments Lite--Community Review Round 1
Paul Backus
snarwin at gmail.com
Fri Feb 15 14:23:06 UTC 2019
On Friday, 15 February 2019 at 12:56:45 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community
> Review for DIP 1019, "Named Arguments Lite":
The fact that named arguments, as proposed, require both the
caller *and* the callee to opt-in seems like it would make them
almost useless in practice. Even if someone's willing to put in
the effort of going through all of Phobos to figure out which
functions should be annotated with @named, that still leaves all
of the packages on code.dlang.org to deal with. Realistically, a
lot of existing code will never be updated to work with this
feature, even if it could benefit from it.
It's also a pretty unsightly wart for newcomers to D to first
learn that D supports named arguments (hooray!), and then find
out that no, they can't use them with <insert package here>
(boo!), because the author of that package hasn't "said the magic
word" to enable them.
I understand that the intent is to avoid unintentional breakage,
but this feature is already opt-in from the caller's side. If
someone wants to write code that's robust against parameter name
changes, they can do it by not using named arguments in the first
place. And, as noted in the DIP itself, there are still
opportunities for accidental breakage even with @named, when the
caller fails to re-compile their code after a parameter name
change.
Parameter lock-in is definitely a legitimate concern, but IMHO
adding a neutered version of named arguments like this one to the
language would be worse than not having named arguments at all.
More information about the Digitalmars-d
mailing list