DIP 1019--Named Arguments Lite--Final Review
Dukc
ajieskola at gmail.com
Tue Aug 27 05:21:55 UTC 2019
I feel this DIP is bashed a bit too heavily here.
I do share the concern of most people that the DIP should include
at least some argument reordering. My impression is that you
removed the reordering you had at community review one to avoid
the `@named` parameter, that was not well received by some.
Unfortunately, preventing all argument reordering just does not
work. Like many have said, such named parameters would be tedious
and likely unpopular to use. But there is another problem too,
one that had you to include argument reordering in the draft
stage, I believe:
´´´
foo(int a, int b)
foo(double b, int a)
´´´
If the dip will consider argument reordering, a call `foo(a:3,
b:3)` can be specified as an ambiguous call, triggering a
compiler error. However, if your DIP as now is implemented, that
call would bind to the first function, preventing ambiguity
checking later on, without core breakage. As long as you have
this problem, it defeats the purpose of "less-is-more" philosophy.
No, you need at least some form of argument reordering. It could
be along the lines of what Walter proposed, or something like
Rikki's base idea (named parameters being separated from unnamed
ones on API, and overload only by unnamed params).
This all being said, you actually wrote a DIP. It's easy to bash
the concept when one has to consider only the concept, not corner
cases and specification. I don't agree with Andrei: writing a DIP
with argument reordering would be a major undertaking, just as
difficult and very possibly more so than this one with all the
corner cases to consider. We can't except to easily find a
champion for that.
Perhaps this DIP can be used incrementally after all, just not by
including it to D as-is. If Rikki's DIP won't get through, and if
someone wants to write a real DIP from Walter's proposal, a lot
of the details are already ready if you paper is used as base.
Even better, if you don't want to do it yourself, you can abandon
the DIP. That way someone can just stick argument reordering in
and go straight to community review past the draft queue (Or can
they? Mike?).
More information about the Digitalmars-d
mailing list