DIP 88: Simple form of named parameters

arturg via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 25 04:56:01 PST 2016


On Monday, 25 January 2016 at 08:55:55 UTC, Jacob Carlborg wrote:
> On 2016-01-24 19:23, Chris Wright wrote:
>
>> It shouldn't. However, it is another way to pass function 
>> arguments, so
>> for thoroughness it would be better to mention it.
>
> Added an example.
>
>> Is this what you intended? If so, please document it so other 
>> reviewers
>> don't have to wonder.
>
> Added an example.

hi, named args is mainly a feature for the caller, is it really 
necessary to add a new syntax to the function definition?
besides making some args part of the api and some not.

and if you cant omit args with default initializer like in your 
example

void foo(int a: = 3, int b: = 4);
foo();
foo(a: 5, b: 6);
foo(b: 6); // this is not allowed since it's not legal to reorder 
the arguments

this feature is nothing more then a comment and the simplest way 
to implement this, is to add a single word comment type which 
might be usefull in more situations.



More information about the Digitalmars-d mailing list