RFC: Change what assert does on error

Timon Gehr timon.gehr at gmx.ch
Fri Jul 4 18:49:50 UTC 2025


On 7/4/25 12:11, Dennis wrote:
> On Friday, 4 July 2025 at 09:56:53 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> scope(exit) is ran when Error passes through it.
>>
>> This is one of the complicating factors at play.
> 
> scope guards and destructor calls are internally lowered to finally 
> blocks, they're all treated the same. But let's say they aren't, that 
> still doesn't answer the question: what error logging code are you 
> writing that relies on clean up code being run? What does the output 
> look like with and without?

With: It writes a file with the full interaction log that leads to the 
crash. The user can see the stack trace in a console window that is kept 
open using `system("pause")`. They can send the data to me and I can 
immediately reproduce the issue and fix the crash within 24 hours.

Without: The program randomly closes on the user's machine and I get no 
further information. I can only speculate what is the cause. It might be 
bad design of the D language, bad defaults, a bug in a (e.g., C) 
dependency, etc. I have no idea. I get one of these reports at most once 
every couple of months, so this is not at the top of my list of 
priorities, even if I know there are further things to try that may or 
may not lead to more information being available.

Anything that causes the second scenario I will strongly oppose, even if 
it's just a default setting.


More information about the Digitalmars-d mailing list