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

Exil Exil at gmall.com
Thu Jun 6 13:19:02 UTC 2019


On Thursday, 6 June 2019 at 10:05:45 UTC, Yuxuan Shui wrote:
> On Wednesday, 5 June 2019 at 15:25:52 UTC, Exil wrote:
>> [snip]
>>> If a function is defined with some of its parameter names 
>>> omitted, arguments to those parameters can labeled with an 
>>> empty name.
>>>
>>> void fun(int);
>>>
>>> fun(:10);
>>
>> Why is this included, what is the use case for it? Why 
>> wouldn't you just use fun(10) instead? If ordering is required 
>> why require the ":" at all?
>
> None of the names are required. This is provided so there is a 
> way to label unnamed parameters if there is a need for it.

Right, but if you are forcing the order of parameter be kept. How 
would having an empty parameter name help anyone identify what it 
is? It is an extra feature that doesn't provide or have any 
purpose.

foo(:10)

is as informative as

foo(10)

Same thing for the following:

foo(10, 20, :30);
foo(10, 20, 30);

If anything the colon adds to confusion.


More information about the Digitalmars-d mailing list