DIP 1019--Named Arguments Lite--Final Review

Yuxuan Shui yshuiv7 at gmail.com
Fri Aug 23 23:19:26 UTC 2019


On Friday, 23 August 2019 at 17:59:38 UTC, Andrei Alexandrescu 
wrote:
> On 8/23/19 1:42 PM, H. S. Teoh wrote:
>> On Fri, Aug 23, 2019 at 05:16:16PM +0000, bachmeier via 
>> Digitalmars-d wrote:
>>> [...]
>> [...]
>>> [...]
>> [...]
>> 
>> But this:
>> 
>> 	foo(x: 4, y: 8, z: 9,
>> 		screen: scr1, widget: wg2,
>> 		options: opts, menu: menu3);
>> 
>> is no worse than this:
>> 
>> 	FooParams params;
>> 	params.x = 4;
>> 	params.y = 8;
>> 	params.z = 9;
>> 	params.screen = scr1;
>> 	params.widget = wg2;
>> 	params.options = opts;
>> 	params.menu = menu3;
>> 	foo(params);
>
> Exactly. It seems that for short lists (2-3 arguments) naming 
> would be a net negative (add notational overhead when there's 
> little possibility of a confusion to start with).

You don't have to add the names, it's not mandatory.

> Then, when the list gets longer it actually makes matters 
> _worse_ because it disallows skipping of defaulted arguments.

What do you mean by "worse". It's not currently possible to skip 
default arguments anyways.

There is no way for incorporating this DIP to be a negative.




More information about the Digitalmars-d mailing list