On 2018-07-08 22:55, John Carter wrote:
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.

There's even a SyntaxError exception class (inheriting from Exception), which you do not want to catch.

--
/Jacob Carlborg

Reply via email to