T.init and @disable this
monarch_dodra
monarchdodra at gmail.com
Thu Oct 4 01:18:14 PDT 2012
I'm trying to find out the exact semantics of
@disable this();
It is not well documented, and the fact that it is (supposedly)
buggy makes it really confusing.
My understanding is that it "merely" makes it illegal to default
initialization your type: You, the developer, have to specify the
initial value.
//----
T t; //initializer required for type
//----
Which means, you, the developper, must explicitly choose an
initial value.
However, DOES or DOES NOT this remain legal?
//----
T t = T.init; //Fine: You chose the initializer T.init
//----
Keep in mind it is not possible to make "T.init" itself
disappear, because nothing can be constructed if T.init is not
first memcopied onto the object, before calling any constructor
proper.
I think this should be legal, because you, the developer, is
asking for it, just the same way one can write "T t = void".
Making it illegal would pretty much make T unmoveable,
un-emplaceable, un-initializeable on un-initialized memmory, and
would probably break more than one function/trait which uses
"T.init"
Feedback?
More information about the Digitalmars-d
mailing list