DIP 1019--Named Arguments Lite--Final Review

matheus matheus at gmail.com
Tue Aug 27 14:07:58 UTC 2019


On Tuesday, 27 August 2019 at 13:47:49 UTC, aliak wrote:
> ...
> struct S { int a = 1, b = 2, c = 3, d = 4; }
>
> void main() {
>     S w = { d: 9, a: 9, 9 };
>     writeln(w);
> }
>
> The answers:
> ...

Looking the snippet I'd expect the result to be: "A", "B" and "D" 
to be 9, which is the case according the compiler.

> 3. does the last 9 set all the unset vars??

Maybe one thing that might be added for "filling" would be:

S w = { d: 9, a: 9, 9... };   // Note the ellipsis "..."

Matheus.


More information about the Digitalmars-d mailing list