RFC: Change what assert does on error

Derek Fawcus dfawcus+dlang at employees.org
Tue Jul 1 08:20:40 UTC 2025


On Monday, 30 June 2025 at 21:18:42 UTC, Sebastiaan Koppe wrote:
> Please don't make this the default. It's  wrong in 99% of the 
> cases.

[snip]

> Just know that the idea of exiting directly when something 
> asserts on the pretense that continueing makes things worse 
> breaks down in multi-threaded programs. All other threads in 
> the program will keep running until that one thread finally 
> ends up calling abort,

If the process has been deemed to be 'doomed' once an assertion 
triggers, I don't see any significant difference in how one 
arranges to end the process.

Calling exit() or calling abort() will both result in the 
destruction of the process.

So are you simply advocating for allowing a program to continue 
operating despite an assertion failure?  In which case, maybe 
there needs to be two different forms of assertion:

a) Thread assert - does something akin to what you want.
b) Process assert - does what others expect, in that the complete 
process will cease.

Then there is the question of how to name the two trigger 
functions so a code can invoke the desired behaviour, and which 
the standard library should use under various conditions.



More information about the Digitalmars-d mailing list