DIP 1019--Named Arguments Lite--Community Review Round 1
Jacob Shtokolov
jacob.100205 at gmail.com
Fri Feb 15 17:06:18 UTC 2019
On Friday, 15 February 2019 at 12:56:45 UTC, Mike Parker wrote:
> This is the feedback thread for the first round of Community
> Review for DIP 1019, "Named Arguments Lite":
I think the "Completeness" section contains some arguable points.
The proposed solution doesn't take into account the cases where
you need to partially skip default arguments.
Say, we have a function:
```void drawCircle(int x, int y, int radius, Border border =
Border.Solid, Bg bg = Bg.Transparent)```
Then we want to call this function with default parameters except
the background (bg).
The best way to do that would be:
```drawCircle(10, 10, 5, bg: Bg.Red);```
So you see that we omitted the "border" parameter.
However, the proposed solution forces us to do that:
```drawCircle(x: 10, y: 10, radius: 5, bg: Bg.Red);```
A lot more unnecessary typing.
Python, for example, allows us to mix both named and unnamed
arguments, and thus effectively skip the default ones.
More information about the Digitalmars-d
mailing list