[dmd-internals] Throwing Errors
Jonathan M Davis
jmdavisProg at gmx.com
Thu Mar 15 15:57:22 PDT 2012
On Thursday, March 15, 2012 15:25:32 Walter Bright wrote:
> I've been arguing with engineers for 25 years who insist that they should be
> able to recover from detected programming bugs. It's wrong, wrong, wrong,
> wrong.
>
> If you want to recover, use an Exception.
In general, I agree. It's just that there are a few cases where it makes
sense. The main one has to do with unit tests. In some cases, it makes sense
to catch an AssertError within a unit test, because assert is what's used in
unit tests. For instance, some programmers want to test their in contracts.
The biggest case though is that some programmers want to build more extensive
unit testing frameworks on top of the built-in one. And to do that, you have
to catch AssertErrors. Personally, I see no need for such frameworks, but some
people (e.g. Jacob Carlborg) definitely want them, and if AssertErrors skip
scope statements, finally blocks, or destructors, that's going to cause major
problems for their frameworks.
- Jonathan M Davis
More information about the dmd-internals
mailing list