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

Panke tobias at pankrath.net
Mon Feb 10 19:30:59 UTC 2020


On Monday, 10 February 2020 at 18:27:49 UTC, Steven Schveighoffer 
wrote:
> On 2/6/20 10:33 PM, Jonathan M Davis wrote:
>> Once in a while, named arguments may
>> be useful, but for the most part, they're useful because a 
>> function has way
>> too many parameters, in which case, the function should have 
>> been designed
>> differently.
>
> I find this assertion lacking evidence.
>

Let me give a data point to the contrary. I am a C++ programmer 
at work and using CLion as my IDE. Recently CLion got the ability 
to display parameter names inline at call sides, that is given a 
function invocation

> foo(bar, baz, baraz)

of a function

> foo(parametertype1 parametername1, parametertype2 
> parametername2, ptype3 pname3)

it will be displayed like this with the parameter names in a 
slight gray:

> foo(parametername1: bar, parametername2: baz, pname3: baraz).

This already saved hours by preventing bugs and is unanimously 
considered an improvement by all my colleagues.

I am convinced named parameters can improve code quality and even 
expect that tooling will show up to insert them automatically in 
existing code, when they get into the language.



More information about the Digitalmars-d mailing list