On Saturday, 25 August 2018 at 07:56:55 UTC, 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.
Then we should add a switch to inject a unittest to run a
destructor on a default initialisable object. i.e. if it has a
static opCall or an @disable this(); then don't otherwise do.
Otherwise this is a well disguised instance of faith based
programming.