D is dead

Shachar Shemesh shachar at weka.io
Sat Aug 25 13:33:47 UTC 2018


On 25/08/18 10:56, Walter Bright wrote:
> On 8/24/2018 6:34 AM, Shachar Shemesh wrote:
>> No, unlike what I suggest, that doesn't work without carefully 
>> reviewing every single place you put it to see whether the constructor 
>> actually supports destructing a partially constructed object.
> 
> All D objects are default-initialized before the constructor sees it 
> (unlike C++). A destructor should be able to handle a 
> default-initialized object.

I'm not talking about a default initialized object. I'm talking about an 
object where the constructor started running, but not to completion.

With that said, this statement is, I think, representative of the Lego 
problem D has. All D objects? Really? Even this one?

struct A {
   int a;

   @disable this();
   @disable init;

   this(int number);
   ~this();
}

If you allow a feature to be disabled, you really need to keep in mind 
that feature might be well and truly disabled.


More information about the Digitalmars-d mailing list