Comparing Exceptions and Errors

Sebastiaan Koppe mail at skoppe.eu
Sat Jun 4 18:32:48 UTC 2022


On Saturday, 4 June 2022 at 17:17:13 UTC, Ola Fosheim Grøstad 
wrote:
> Why can't Error unwind the stack properly?

It does normally, but it doesn't destruct objects when those are 
in `nothrow` functions.

Nothrow functions don't throw, so have no cleanup.

You could argue it is strange that assert throws...

> In a not-miniscule service you can be pretty certain that some 
> ±1 bugs will be there, especially in a service that is 
> receiving new features on a regular basis.

Most wont throw a Error though. And typical services have canary 
releases and rollback.

So you just fix it, which you have to do anyway.

Not saying its perfect, but if you only use asserts when you have 
to, and handle other things using the type system, it doesn't 
actually happen all that often.



More information about the Digitalmars-d-learn mailing list