DIP 1019--Named Arguments Lite--Final Review

a11e99z black80 at bk.ru
Fri Aug 23 19:57:05 UTC 2019


On Friday, 23 August 2019 at 19:48:59 UTC, Paul Backus wrote:
> On Friday, 23 August 2019 at 19:33:07 UTC, Dennis wrote:
>
> Walter's proposal from the previous discussion was that named 
> parameters should use the same rules for reordering as named 
> struct initialization [1] (which in turn are the same rules 
> used by designated initializers in C99 [2]). So in this case, 
> the second overload would be called, because it's the only one 
> with a parameter after `b`.
>
> Even if these aren't your favorite rules, I think there's a lot 
> to be said for consistency.
>
> [1] https://dlang.org/spec/struct.html#static_struct_init
> [2] http://port70.net/~nsz/c/c99/n1256.html#6.7.8p17

> struct S { int a, b, c, d = 7; }
> S w = { b:1, 3 };             // v.a = 0, v.b = 1, v.c = 3, v.d 
> = 7

unnamed arg after named is weird/error prone. u should to know 
right order
(here names are ordered so it not usual case)
imo better forbid named args before unnamed OR unnamed args after 
named
> unnamed, unnamed, unnamed, named, named, named


More information about the Digitalmars-d mailing list