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

jmh530 john.michael.hall at gmail.com
Wed May 13 20:20:47 UTC 2020


On Wednesday, 13 May 2020 at 19:55:20 UTC, Jonathan Marler wrote:
> [snip]
>>
>> 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.

I think the broader point though is that if the technique 
shouldn't be used on `copy` than it isn't a general solution for 
interacting with someone else's library.

What about an attribute? Perhaps @positionalOnly. It's ugly, but 
at least it's self-documenting. Using a named parameter with an 
@positionalOnly parameter would result in an error. This makes 
@positional opt-in and used rarely.


More information about the Digitalmars-d mailing list