Struct initialization using member syntax without variable

2016-01-14 Thread Jacob Carlborg via Digitalmars-d
To initialize a struct with the member names a variable is required. Example: struct Foo { int a; int b; } Foo foo = { a: 3, b: 4 }; That's a bit annoying when you want to pass the struct to a function or return it. Foo bar() { return { a: 3, b: 4 }; // error } void bar(Foo

Re: Struct initialization using member syntax without variable

2016-01-14 Thread Jacob Carlborg via Digitalmars-d
On 2016-01-14 13:22, w0rp wrote: Maybe there is some parsing difficulty, but if it's possible to add something like this, I think it would be nice. I hardly doubt it. -- /Jacob Carlborg

Re: Struct initialization using member syntax without variable

2016-01-14 Thread w0rp via Digitalmars-d
Maybe there is some parsing difficulty, but if it's possible to add something like this, I think it would be nice.