4 ms·
I think most people who are pleased with the reliability of Go are coming from something like Python where unforeseen things pop up out of nowhere on rare code
by thrownaway2424 13y ago
I think most people who are pleased with the reliability of Go are coming from something like Python where unforeseen things pop up out of nowhere on rare code paths nobody anticipated. Things like a rare error handling path where some piece of code iterates over a string the author thought was a list, etc.
Or perhaps they are coming from C++ where use-after-free or use-of-uninitialized or use-of-perversely-initialized are common at runtime. Go has none of that.
- jbooth 13y agoOr java/c# where exceptions tend to bubble all the way up the stack and where you have to to try/finally which can be harder to write safe code with than defer.
- danieldk 13y agoOr 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.
- pjmlp 13y agodefer is no different than using(C#), try-resources(Java), scope(D), with(Python).
- jbooth 13y agotry-resources is new in java, didn't realize that c# had using. I wasn't claiming it was revolutionary, just that it's nice.