Go, D, and the GC
Shachar Shemesh via Digitalmars-d
digitalmars-d at puremagic.com
Mon Oct 5 02:25:30 PDT 2015
On 05/10/15 10:40, deadalnix wrote:
> Guaranteed construct/destruction is actually a desirable feature IMO.
> You get all kind of extra case int he dtor to care for when you can't
> ensure proper construction, and it is not always possible to have a
> meaningful .init value, leading to many useless runtime checks or an
> invalid dtor.
>
What's more, init is used even if you @disable this(). The following
compile and does what you'd expect (but not what you want):
struct S {
int d;
@disable this();
this( int d ) {
this.d = d;
}
}
...
S d = S.init;
Shachar
More information about the Digitalmars-d
mailing list