DIP 1019--Named Arguments Lite--Community Review Round 2

Timon Gehr timon.gehr at gmx.ch
Thu Jun 6 23:45:25 UTC 2019


On 06.06.19 22:04, Walter Bright wrote:
> I'll reiterate what I wrote for DIP1020 
> https://digitalmars.com/d/archives/digitalmars/D/DIP_1020--Named_Parameters--Community_Review_Round_1_325299.html#N325627 
> 
> 
> ---
> 
> Here's a much simpler proposal, based on the recognition that D already has
> named parameters:
> ...

I think this is indeed the way to go, but ideally, named arguments would 
become first-class citizens. E.g., this should work: [1]

void foo(int x,string y){}

void main(){
     auto t=tuple(y: "123", x: 2);
     foo(t.expand); // ok
}

I.e., named arguments should be allowed in alias sequences.

This is important e.g. for forwarding applications.



[1] With the tuple DIP, it would become just

void main(){
     auto t=(y: "123", x: 2);
     foo(t);
}


More information about the Digitalmars-d mailing list