DIP 1019--Named Arguments Lite--Community Review Round 2
Aliak
something at something.com
Thu Jun 6 21:43:10 UTC 2019
On Thursday, 6 June 2019 at 20:04:15 UTC, Walter Bright wrote:
> discovered as necessary behavior. Consider:
>
> void snoopy(T t, int i, S s); // A
> void snoopy(S s, int i = 0; T t); // B
>
> and calling it:
>
> S s; T t; int i;
> snoopy(t, i, s); // A
> snoopy(s, i, t); // B
> snoopy(s, t); // error, neither A nor B match
> snoopy(t, s); // error, neither A nor B match
> snoopy(s:s, t:t, i:i); // error, ambiguous
> snoopy(s:s, t:t); // B
> snoopy(t:t, s:s); // B
> snoopy(t:t, i, s:s); // A
> snoopy(s:s, t:t, i); // A
Trying to understand why the last two call A and are not
ambiguous?
> One issue would be order of evaluation: would the arguments be
> evaluated in the
> lexical order of the arguments, or the lexical order of the
> parameters?
Arguments would provide consistency but parameters feel more
intuitive from a user perspective. But yeah, hard to say!
More information about the Digitalmars-d
mailing list