What should happen when the assert message expression throws?
Dukc
ajieskola at gmail.com
Thu Dec 8 16:22:16 UTC 2022
On Friday, 25 November 2022 at 12:29:26 UTC, Ali Çehreli wrote:
> On 11/25/22 00:12, Dukc wrote:
>
> >> Discussion: As I commented on the bug report as well, D is
> already in
> >> the best-effort business when it comes to Errors:
> >
> > What does "best-effort" mean?
>
> (I am not sure whether I should have used the word "hopeful"
> here. I will continue with best-effort.)
>
> [snip]
Thanks for the explanation.
> Add to the above another observation which I had after Patrick
> Schluter's message: Even the execution of the assert check is
> best-effort because if the check will fail, the program has
> been in invalid state for an unknow amount of time anyway.
I disagree slightly. Yes, the higher level purpose the assertion
is accomplishing is best-effort - that is, shutting down a
program overtaken by a bug. But I think the implementation itself
should not be so. If we assert that x is 5, catching x being 4
must happen every single time, not on best effort basis, unless
the assertion is disabled by a compiler switch.
More information about the Digitalmars-d
mailing list