December 04, 2015 Re: Struct initializers as expressions | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | 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.
|
Copyright © 1999-2021 by the D Language Foundation