DIP 1019--Named Arguments Lite--Community Review Round 2
Patrick Schluter
Patrick.Schluter at bbox.fr
Sun Jun 9 07:58:26 UTC 2019
On Sunday, 9 June 2019 at 02:49:13 UTC, Jonathan Marler wrote:
> I think your point is that when developers write code like
> this, having to put arguments in a particular order seems like
> an unnecessary burden. I agree it's an extra burden on the
> writer, but enforcing the same order reduces the complexity of
> overload resolution and knowing how to map arguments to
> parameters, something which the "reader" needs to be able to do
> whenever they see a function call.
>
> Consider,
>
> foo(int a, int b, int c, int d, int e, int f);
>
> foo(1, 2, 3, 4, 5, 6); // a=1, b=2, c=3, d=4, e=5, f=6
>
> Now let's see it with some argument re-ordering:
>
> foo(6, c=1, e=2, 3, b=4, e=5, a=7);
overload error, you have 7 parameters here but only 6 in the
definition and no 7 parameter overload.
>
> What's the values of a/b/c/d/e/f in this case? This may have
> made sense when it was written, but this is not beneficial for
> the reader.
none, it's a compilation error
More information about the Digitalmars-d
mailing list