4 ms·
Or java/c# where exceptions tend to bubble all the way up the stack There is really no difference. In Java you have to decide at what level to catch exceptions
by danieldk 13y ago
Or java/c# where exceptions tend to bubble all the way up the stack
There is really no difference. In Java you have to decide at what level to catch exceptions. In Go you have to decide at what level to handle an error and just not return it. In fact, if you have to pass an error on level further up the stack, it's easier in Java.
have to to try/finally which can be harder to write safe code with than defer.
Why? I suppose that you are referring to the fact that you can put a defer right next to e.g. opening a file. But Java has the (arguably) nice(r) try-with-resources construct since Java 7:
http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html http://docs.oracle.com/javase/tutorial/essential/exceptions/...
- jbooth 13y agoI'm not a Java hater, I love it, but a lot of code tends to be written as just "throws IOException". I've written a lot of code like that. Go forces you to handle each error separately, which can be nice.