Hello!
I've managed to have a chat with Walter to discuss what assert does on error.
In recent months, it has become more apparent that our current error-handling behaviours have some serious issues. Recently, we had a case where an assert threw, killed a thread, but the process kept going on. This isn't what should happen when an assert fails.
An assert specifies that the condition must be true for program continuation. It is not for logic level issues, it is solely for program continuation conditions that must hold.
Should an assert fail, the most desirable behaviour for it to have is to print a backtrace if possible and then immediately kill the process.
What a couple of us are suggesting is that we change the default behaviour from throw AssertError
.
To: printBacktrace; exit(-1);
There would be a function you can call to set it back to the old behaviour. It would not be permanent.
This is important for unittest runners, you will need to change to the old behaviour and back again (if you run the main function after).
Before any changes are made, Walter wants a consultation with the community to see what the impact of this change would be.
Does anyone have a case, implication, or scenario where this change would not be workable?
Destroy!