RFC: Change what assert does on error
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sun Jun 29 20:58:36 UTC 2025
On Discord Timon has demonstrated two circumstances that kill this.
1. Error will still do cleanup in some cases (such as scope exit).
2. Contract inheritance catches AssertError, and we can't reliably swap
that behavior.
The conclusions here is that:
1. The Error hierarchy is recoverable, it differs from Exception by
intent only.
2. ``nothrow`` cannot remove unwinding tables, its purpose is logic
level Exception hierarchy denotation. If you want to turn off unwinding
there will need to be a dedicated attribute in core.attributes to do so.
3. The Thread abstraction entry point needs a way to optionally filter
out Error hierarchy. Using a hook function that people can set, with
default being kill process.
4. assert is a framework level error mechanism, not "this process can't
continue if its false". We'll need something else for the latter, it can
be library code however.
I know this isn't what everyone wants it to be like, but this is where D
is positioned. Where we are at right now isn't tenable, but where we can
go is also pretty limited. Not ideal.
More information about the Digitalmars-d
mailing list