DIP 1019--Named Arguments Lite--Final Review

Dennis dkorpel at gmail.com
Fri Aug 23 11:44:25 UTC 2019


On Friday, 23 August 2019 at 10:54:11 UTC, Mike Parker wrote:
> Thanks in advance for your participation.

I like how this DIP evolved. The first version looked very 
unattractive, but it's shaping up to be an elegant proposal. My 
points for this version:

> In addition, this proposal has the added benefit of protecting 
> against silent breakage in cases when a function's parameters 
> are repurposed and renamed. For example:

Even with named arguments, I wouldn't dare to change the 
parameter meaning without changing the type. If someone doesn't 
use named parameters he gets silent breakage anyways. I don't 
think this is a strong argument in favor of named arguments.

The Prior Work section shows some examples of named parameters in 
other languages, but it doesn't tell why you chose these 
languages / why these languages chose their design.

I like the solution to parameter name lock-in, it uses existing 
languages features for an elegant solution.
> A survey of name changes in popular libraries done by the 
> authors of a similar proposal introducing named arguments to 
> C++ suggests this kind of breakage should be rare.
Can you add a reference to this?

What is the rationale behind variadic functions `args[0]: 
"string"` or paramater name omission `fun(:10)`?

The grammar changes propose an addition to `ArgumentList`. This 
production rule is used in other places than function calls 
though, so this is allowed by the new grammar:
```
mixin(name: "x = 3;");
```




More information about the Digitalmars-d mailing list