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

Timon Gehr timon.gehr at gmx.ch
Fri Feb 7 03:49:03 UTC 2020


On 06.02.20 07:09, Mike Parker wrote:
> ...
> 
> You can find DIP 1030 here:
> 
> https://github.com/dlang/DIPs/blob/44b0d4ec0da6a2e797ede748fb1e81cd6db10371/DIPs/DIP1030.md 
> 
> ...
This introduces syntax like:

import std.typecons;
alias t=AliasSeq!(c:1, a:2, b:3); // valid according to DIP
void foo(int a,int b,int c){
     writeln(a," ",b," ",c);
}

void main(){
     foo(t);
}

I'd expect this to print "2 3 1".

I think this is important for forwarding applications, so deserves 
explicit treatment. There should also be a way to access the argument 
names in a given sequence.

This is also the reason why I think this part of the DIP is probably not 
ideal: "If there are more NamedArguments than Parameters, the remainder 
match the trailing ... of variadic parameter lists, and Identifiers are 
not allowed."

IMHO, any leftover named arguments should be collected into the variadic 
parameters.


More information about the Digitalmars-d mailing list