News for hackers. Stuff that matters.
Re:"BitC isn't going to work in its current form" by batista on Sunday March 25, 2012 @07:10AM (#3752299)
>* Having to check errors is annoying since most of the time you want to bubble the error up to your caller.*

No, most of the time I don't.

Re:"BitC isn't going to work in its current form" by ootachi on Sunday March 25, 2012 @10:56AM (#3752731)
What do you do then?

If the answer is "panic", note that exceptions are superior here, since exceptions let you "panic" without having to litter your code with those calls.

If the answer is some form of "log an error message", exceptions are superior, since you can group multiple related calls into one try-catch block and avoid having to check at the site of each and every call.

If the answer is some form of "return a different error code to your caller", exceptions are superior, because you can catch many different types of exceptions in one try-catch block and re-throw a different exception.

Re:"BitC isn't going to work in its current form" by batista on Sunday March 25, 2012 @12:32PM (#3752978)
>If the answer is "panic", note that exceptions are superior here, since exceptions let you "panic" without having to litter your code with those calls. If the answer is some form of "log an error message", exceptions are superior, since you can group multiple related calls into one try-catch block and avoid having to check at the site of each and every call. If the answer is some form of "return a different error code to your caller", exceptions are superior, because you can catch many different types of exceptions in one try-catch block and re-throw a different exception.

How about locally handling the problem --which could be some non-issue-- and continue without the OVERHEAD of an Exception?

How about now using the verbose and convoluted try-catch-finally idiom for common and not at all exceptional error conditions?

How about THINKING about the error handling, instead of blindly catching "many different types of exceptions in one try-catch block and re-throw a different exception", which we've known for Java to result in a mess...

How about avoiding the exception stack penalty that happens when you "group multiple related calls into one try-catch block and avoid having to check at the site of each and every call" to merely log errors?