On Thu, Mar 04, 2021 at 11:42:58PM +0000, Dukc via Digitalmars-d-announce wrote: > On Thursday, 4 March 2021 at 13:54:48 UTC, Mike Parker wrote: [...] > If an assert was failing, the program is going to terminate anyway, so > InvalidMemoryOperationError is no problem. Well, it might obfuscate > the underlying error if there is no stack trace, but banning > `assert`ing in anything that could be called by a destructor sounds > too drastic to me. Even the lowest level system code tends to contain > asserts in D, at least in my codebase. If asserting is banned, > destructors can do faily much nothing. I'd think it's much more > practical to redefine the assert failure handler if > InvalidMemoryOperationError due to a failed assert is a problem.
This is precisely why Walter (and others) have said that assert failures should not throw anything, they should simply terminate (perhaps calling a user-defined panic function right before aborting, if special handling is needed). That, or we take Mike's advice to pretend that class dtors don't exist. T -- The diminished 7th chord is the most flexible and fear-instilling chord. Use it often, use it unsparingly, to subdue your listeners into submission!