Comparing Exceptions and Errors

Sebastiaan Koppe mail at skoppe.eu
Sat Jun 4 16:55:50 UTC 2022


On Saturday, 4 June 2022 at 14:19:22 UTC, Ola Fosheim Grøstad 
wrote:
> Also, what it is the purpose of @safe if you have to kill all 
> threads? Such rigidity will just make Go look all the more 
> attractive for service providers!

I agree with this, but given the current semantics there is 
nothing else to do but teardown everything upon first sight of 
Error.

The reasoning is simple: Error + nothrow will sidestep any RAII 
you may have. Since you cannot know what potentially wasn't 
destructed, the only safe course of action is to abandon ship.

Yes, in plenty of cases that is completely overkill.

Then again, programs should be written to not assert in the first 
place.

Considering most asserts I have seen are either due to a bad api 
or just laziness - and shouldn't have to exist in the first place 
- maybe it's not that bad.


More information about the Digitalmars-d-learn mailing list