DIP 1030--Named Arguments--Community Review Round 1 Discussion

Paul Backus snarwin at gmail.com
Sat Feb 8 01:04:42 UTC 2020


On Friday, 7 February 2020 at 19:44:31 UTC, bachmeier wrote:
> On Friday, 7 February 2020 at 19:02:14 UTC, matheus wrote:
>
>> "...named arguments may be useful, but for the most part, 
>> they're useful because a function has way too many parameters, 
>> the function should have been designed differently.".
>
> It actively encourages a style of "just add another function 
> argument". You start small and as you decide to change your 
> function, it's easy to fall into the trap of adding one more 
> argument, because the end user is free to ignore it.

People will do this anyway, whether or not the language has named 
arguments. In fact, here are a couple examples in D where it's 
been done in the past:

- https://github.com/dlang/dmd/pull/8195
- https://github.com/dlang/druntime/pull/2376

At least with named arguments, I have the option of writing 
`destroy!(initialize: false)(foo)`, instead of just 
`destroy!false(foo)`.


More information about the Digitalmars-d mailing list