RFC: Change what assert does on error

Derek Fawcus dfawcus+dlang at employees.org
Mon Jul 7 21:36:34 UTC 2025


On Monday, 7 July 2025 at 21:17:57 UTC, 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.
>
> 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.
>
> Now this wouldn't exit the failed program very quickly, but at 
> least it would exit it and preserve the stack trace and 
> possibility to catch the error.

That sort of thing is explicitly what does not happen in Go when 
a goroutine panics.

Simply because it does not make sense to attach / associate a 
stack trace from one thread/fiber/coroutine with another.




More information about the Digitalmars-d mailing list