News for hackers. Stuff that matters.
Re:Why Go Is An Excellent Modern Programming Language by norswap on Sunday July 28, 2013 @07:14PM (#6118497)
Didn't know about defer, cool. You can use Java's finally in a similar manner (although the syntax is worse, and you can't scatter the logic like with defer).

> I see it more as explicit. You HAVE to decide what you're going to do in case of an error. Usually it's as simple returning that error, but sometimes you want to do more, and having the question constantly being asked means you think about it for all cases.

Checked exceptions also do that (you have to add "throws" statements) and it looks much cleaner. I must however say that I'm not a fan of checked exceptions either.

Re:Why Go Is An Excellent Modern Programming Language by dom96 on Sunday July 28, 2013 @07:24PM (#6118525)
> Checked exceptions also do that (you have to add "throws" statements) and it looks much cleaner. I must however say that I'm not a fan of checked exceptions either.

Indeed. I was going to mention checked exceptions too. I think they are a great alternative, and personally I do not wish to use a programming language with no exceptions.

I must ask, why are you not a fan of checked exceptions?

Re:Why Go Is An Excellent Modern Programming Language by norswap on Monday July 29, 2013 @10:59AM (#6121484)
For the same reason I don't like errors in return values: most of the times you cannot recover from failure, only do some cleanup. Since you should always consider than anything you call may fail and put your cleanup in a finally/defer, you don't really need checked exceptions.

Even in say, a GUI application (which you don't want to crash on failure), you'll usually contain all failures at some level and for instance display a pop-up indicating that something failed.

I suppose checked exceptions are good for recoverable failures, but I encounter preciously few of those.