DIP 1030--Named Arguments--Community Review Round 1 Feedback

Walter Bright newshound2 at digitalmars.com
Sat Feb 8 03:49:53 UTC 2020


On 2/7/2020 3:44 PM, Timon Gehr wrote:
> 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);

I see where this is coming from, but it just makes my head hurt. There is no 
parameter named 'b', this should never compile. If it did, I can Scott Meyers 
putting this up on a slide with the caption "Never Do This".


> Constructs like https://dlang.org/library/std/typecons/proxy.html should ideally 
> not break.

The more I think about this, the more it looks like supporting variadic 
arguments with named parameters just doesn't make sense. We don't need to make 
it work, either.



More information about the Digitalmars-d mailing list