News for hackers. Stuff that matters.
Re:Why we avoid throwing exceptions at StackMob by tempaccount9473 on Wednesday March 20, 2013 @02:06PM (#5409023)
So they have created an mechanism that allows replacing a small subset of what execptions can do (communicate errors to the callers of a function).

The downside is they need to write all code in a non-standard idiom, need wrappers around standard libraries, cannot easily bubble up errors through multiple levels of the callstack when appropriate, and have made their typing system significantly more complex.

I cannot see an upside.

The example they gave, that division by zero is a "crafty little exception can sneak out of our net and crash our program", could just have easily been solved by wrapping division in a try/except block that caught the RuntimeException, and threw a MyDivisionByZero exception. Then the compiler would enforce that the exception must be caught, elimiating their handwaving argument that unchecked runtime exceptions are "the wild west".

There are no comments on this comment yet.