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

Steven Schveighoffer schveiguy at gmail.com
Thu Feb 13 12:51:09 UTC 2020


On 2/12/20 4:53 PM, Sasha wrote:
> On Wednesday, 12 February 2020 at 20:11:14 UTC, Steven Schveighoffer wrote:
>> My second most used language is Swift, which requires named 
>> parameters. There are some cool things you can do with function and 
>> parameter names when they are significant. I think it's going to be a 
>> net benefit. We just have to resolve the introspection issue.
> 
> Since I never used named arguments, I mean I never opted to and since 
> you have, can you share about the problems, because it must have some 
> problems, changing the names will cause problem, but how this happen in 
> production?

Swift is notorious for making breaking changes, including function and 
parameter names (which are technically part of the function name), but 
provides generally a rich tool in xcode to upgrade your code to deal 
with the differences.

Of course, it's not always perfect. I was pissed when they removed for 
loops without providing a replacement.

But renaming of function names AND parameters is handled quite easily.

It is definitely a difference for a language that has had named 
parameters from the beginning vs. one that suddenly allows that. The 
mentality is different and the care for parameter names is different.

If this DIP is accepted, I expect some growing pains, but it should be 
pretty much fine pretty quickly IMO.

> Like I said above I'm curious about this feature, and why C/C++ which 
> have a bigger user base never bothered about adding this feature.

There's lots of useful things C/C++ could add that they haven't. The bar 
to cross for C++ new features is going to be a difficult threshold for 
any feature, including named parameters, regardless of the utility or 
benefits. They just don't like to change much. I don't know that I would 
ascribe some inherent problem with named parameters as the cause of it 
not being in C++, or really any language. Changing a language always has 
to be worth it to the maintainers, and opinions on this feature differ 
widely even here.

-Steve


More information about the Digitalmars-d mailing list