RFC: Change what assert does on error

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Tue Jul 8 07:40:23 UTC 2025


On 08/07/2025 9:17 AM, Dukc wrote:
> On Sunday, 29 June 2025 at 18:04:51 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> Should an assert fail, the most desirable behaviour for it to have is 
>> to print a backtrace if possible and then immediately kill the process.
> 
> No, this breaks code a bit too hard as written by many.

We've confirmed it.

> I think that ideally, when you wait for or poll a message from a thread 
> (or fiber) that has exited with an unrecoverable error, that error would 
> get rethrown from the waiting point. That way, unless the error is 
> handled every thread would eventually get killed.

Threads quite often never join. This is a very real problem, the 
initiation of this N.G. thread was because a thread wasn't joined and it 
died, but didn't kill the process.

The default for a thread should be to consume the Error and kill the 
process. But configurable in case people do handle it appropriately.



More information about the Digitalmars-d mailing list