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

Reply via email to