D is dead

Shachar Shemesh shachar at weka.io
Fri Aug 24 07:31:21 UTC 2018


On 24/08/18 05:33, Jonathan M Davis wrote:
> 
> Yeah. I've used RAII plenty in D without problems, but the fact remains that
> certain uses of it are very broken right now thanks to the constructor
> issue. I suspect that Shachar's as negative about this as he is in part
> because having RAII go wrong with the kind of low-level stuff Weka does
> would be a serious problem

Yes.

I will point out that I was never bit by this bug either. We found it 
while trying to figure out whether we want to start relying on 
destructors internally.

The thing is, when a destructor doesn't run, this costs you a *lot* of 
time in finding out why. We actually have stuff that is downright weird 
as a result of not trusting destructors.

That stuff is so weird, that for Mecca I essentially said I'm going to 
rely on them. Sadly, this means that this bug has become a bigger 
blocker than it was.

>> (Having throwing destructors is even worse, it's just madness. Although it
>> is allowed in C++, it doesn't actually work.)
> 
> Yeah. We probably should have required that destructors be nothrow and force
> destructor failures to be treated as Errors.

I'm sorry, but I'm not following your logic.

If you're willing to have an error raised by a destructor abort the 
whole program, isn't the C++ solution preferable (abort the program only 
on double errors, which hardly ever happens)?

Shachar


More information about the Digitalmars-d mailing list