On Saturday, 7 July 2018 at 01:18:21 UTC, wjoe wrote:
But that's not how D works. It throws an Error which can be
caught.
If people are allowed to do something they assume it's
legitimate.
It should be a compile time error to catch an Error, but it
doesn't even emit a warning and it seems to work well which is
probably proof enough for people to assume it's good.
I got myself so tangled up in knots with the equivalent in
Ruby.... You can "rescue" the base Exception class... which
initially I did everywhere to try give better error messages...
Which more often than not would result in everything going weird
and insane instead of useful.
Eventually I replaced _every_ "rescue Exception" with "rescue
StandardError" and life improved majorly.
Seriously folks, trying to "catch and handle" a programming bug
leads to the very dark side of life.
Especially in a 'C/C++/D" like language where the exception is
concrete evidence that the system is _already_ in an undefined
and unreliable state.