On Saturday, 19 November 2022 at 08:11:45 UTC, Dukc wrote:
>On Friday, 18 November 2022 at 12:36:14 UTC, RazvanN wrote:
>What do you think? Is deprecating having an assert message that may throw a severe restriction? Are there other rewrites that I am missing?
In my opinion the fix is clear. When the assertion handler at DRuntime determines the assertion has failed, it should call the error message generator (it is lazy IIRC) in a try/catch block. If the generator throws an exception, the error message of assertion failure should be something like <FormatException thrown while writing error message>
.
Should the error generation exception be the .next
member of AssertError
? Probably, but I'm not sure.
If the message generator throws an unrecoverable error, that should probably still mask the assert error. If a RangeError
masks AssertError
it's unlikely to be a problem since neither is likely to be caught and at least in my mind they're essentially the same - a "bug detected" error.
I agree with what you are saying. It think it is essentially what I wrote above but writing a better error message than I suggested.