Discussion Thread: DIP 1030--Named Arguments--Final Review

Jonathan Marler johnnymarler at gmail.com
Wed May 13 19:55:20 UTC 2020


On Wednesday, 13 May 2020 at 19:48:58 UTC, Panke wrote:
> On Wednesday, 13 May 2020 at 19:44:32 UTC, Jonathan Marler 
> wrote:
>> I found a way:
>>
>> void copy(string, string destination)
>> {
>>     alias source = _param_0;
>> }
>>
>> I didn't realize you could do this till now but this allows 
>> functions to "opt-out" of using named parameters.  We may want 
>> to consider using this pattern throughout phobos/druntime when 
>> we want want to prevent parameter names from being apart of 
>> the API.
>
> Makes the documentation worse though.

If it makes the documentation worse then it means the parameter 
names were helpful to the API, in which case you wouldn't do 
this.  The "copy" function isn't a good example because the 
"source" and "destination" parameter names are actually helpful 
to include.



More information about the Digitalmars-d mailing list