Struct initializers as expressions

Chris Wright via Digitalmars-d-learn digitalmars-d-learn at
Fri Dec 4 08:00:19 PST 2015

On Fri, 04 Dec 2015 15:07:01 +0100, Jacob Carlborg wrote:

> But I do see a problem, which I'm guessing Walter would point out as
> well. It might/will complicate the overloading rules. What if "a" and
> "b" in T would be integers instead. I think that would be ambiguous.

Right. I would much rather keep any DIPs minimal in terms of scope and 
compiler changes. It could cause headaches with overload resolution if 
you didn't require the struct name in the literal, so I won't propose 
that at first. If named arguments come along, it would require additional 
care not to conflict with no-parentheses struct literal arguments.

And what if a function takes two structs as parameters?

Plus there would be issues with people mixing no-parens struct fields 
with positional parameters and getting confused.

More information about the Digitalmars-d-learn mailing list