DIP 1030--Named Arguments--Community Review Round 1 Discussion
Timon Gehr
timon.gehr at gmx.ch
Sat Feb 8 10:06:54 UTC 2020
On 07.02.20 21:49, jmh530 wrote:
> On Friday, 7 February 2020 at 20:02:18 UTC, Walter Bright wrote:
>> [snip]
>>
>> So,
>>
>> void foo(int a, ...);
>>
>> called with:
>>
>> foo(b:1, 2)
>>
>> should be the equivalent of:
>>
>> foo(2, 1)
>>
>> ?
>
> This was on the feedback thread, but I didn't want to pollute that...
Here's my answer from the feedback thread:
I was thinking about template variadics, not sure about the C-style
ones. I think your example would not match in any case, because unnamed
arguments after a named argument match the next parameter, so actually
you don't provide a value for 'a'. Also, the name would have to be
preserved through the template instantiation.
void foo(T...)(int a, T args){ ... }
foo(b: 1, a: 2)
<=>
foo!(b: int)(2, 1);
Constructs like https://dlang.org/library/std/typecons/proxy.html should
ideally not break.
More information about the Digitalmars-d
mailing list