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

Daniel N no at public.email
Wed Feb 27 18:51:40 UTC 2019


On Wednesday, 27 February 2019 at 18:16:32 UTC, JN wrote:
> On Wednesday, 27 February 2019 at 12:49:52 UTC, Joseph Rushton 
> Wakeling wrote:
>> ```
>> foo({ beta: 6.5, omega: 101 });
>> ```
>>
>
> This would be great.

It would be great indeed, but insufficient.

At least I can't find a reasonble struct based solution which 
handle default arguments correctly.

struct dim {
   uint w=5;
   uint h=5;
}

void foo(dim d={w:10, h:10}){}
void bar(dim d={w:20, h:20}){}

foo({w:50}); // h should default to 10 but it likely will be 5
bar({w:50}); // h should default to 20 but it likely will be 5



More information about the Digitalmars-d mailing list