DIP 88: Simple form of named parameters

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 23 18:51:43 PST 2016


On Saturday, 23 January 2016 at 14:19:03 UTC, Jacob Carlborg 
wrote:
> This is mostly to prevent ugly hacks like Flag [1].
>
> http://wiki.dlang.org/DIP88
>
> [1] https://dlang.org/phobos/std_typecons.html#.Flag

To be pedantic, this would be adding named arguments, not named 
parameters. The parameters are already named, but mixing up 
arguments and parameters is a common mistake to make, and folks 
do frequently talk about named parameters with regards to this 
sort of feature.

Regardless, I for one, hope that we never have named arguments. 
It's just one more thing that's then part of the function's 
signature that you can't change without breaking code and will 
cause that much more bikeshedding. At least right now, parameter 
names don't matter much, whereas if they're part of the API, then 
they're open to all of the issues that function naming has.

And while I appreciate that this DIP does not make named 
arguments the default behavior for a function, making it up to 
the library writer whether they support named arguments or not is 
likely to create a lot of bikeshedding and debates over whether a 
particular function or library should support named arguments. 
Personally, I'd never use them under any circumstances.

However, I do appreciate that the DIP doesn't allow for 
reordering the arguments based on their names. It does make named 
arguments a bit less ugly.

- Jonathan M Davis


More information about the Digitalmars-d mailing list