dmd 2.063 beta 5
Dicebot
m.strashun at gmail.com
Mon May 27 01:37:08 PDT 2013
On Monday, 27 May 2013 at 07:32:15 UTC, TommiT wrote:
> I don't see a reason why we couldn't have both ways (1. member
> initializers and 2. CTFE-able default constructor) for defining
> the init state of structs. Probably the sensible thing would be
> to make all member initializers illegal iff a default
> constructor has been defined for a struct. I'd be interested in
> seeing a proper feature request discussion about this in a
> dedicated forum or at bugzilla.
Well, technically we can, of course, it won't be that different
from current situation (even more confusing though). Consistency
issue Don has convinced me about though is that can't be such
thing as "member initializer" for non-static members, as there is
nothing to initialize there. Initialization happens when variable
is created and that is defined by combination of T.init, struct
literal syntax and constructors. So, contrary to usual local
variable use case, the very same "member initializer" syntax does
not really initialize anything, it just changes T.init value.
I don't feel it is important enough to actually change anything
but worth remembering as language design nitpick.
More information about the Digitalmars-d-announce
mailing list