On 2/10/15 12:15 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Tuesday, February 10, 2015 11:16:21 via Digitalmars-d-learn wrote:
On Monday, 9 February 2015 at 20:15:28 UTC, Jonathan M Davis
Why would it we even allow it? What benefit is there? It's
meaningless.
@disable this(); is for disabling the init property on structs.
Classes
themselves have no init values - and their references have null
as their
init value.
No, `@disable this()` does _not_ disable the init property on
structs. It disables default, i.e. argument-less construction.
Which is analogous to `new MyClass()`. It makes perfect sense to
disable argument-less construction in classes, just like with
structs. (They are of course different, in that struct default
constructors don't "do" anything, but that's not relevant here.)
Well, then that's a change. It used to be that @disable this() completely
disabled the init property. So, I guess now it just disables its implicit
use, which probably screws up its use for stuff like a NonNullable (which is
why it exists in the first place), but having types without an init property
definitely would make things nasty with generic code (which is where we sat
for a while, I believe).
No, it's not a change. You could always do:
S s = S.init;
What the feature disabled is this:
S s;
-Steve