On Sunday, 5 June 2022 at 23:57:19 UTC, Steven Schveighoffer
wrote:
It basically says "If this condition is false, this entire
program is invalid, and I don't know how to continue from here."
No, it says: this function failed to uphold this invariant. You
can perfectly well recover if you know what that function touches.
For instance if a sort function fails, then you can call a slower
sort function.
Or in terms of actors/tasks: if one actor-solver fails
numerically, then you can recover and use a different
actor-solver.
An assert says nothing about the whole program.
An assert only says that the logic of that particular function is
not meeting the SPEC.
That’s all. If you use asserts for something else then you don’t
follow the semantic purpose of asserts.
Only the programmer knows if recovery is possible, not the
compiler.
A failed assert is not implying undefined behaviour in @safe code.