Re:On comparing languages, C++ and Go
by georgemcbay on Sunday October 06, 2013 @03:46AM
(#6503467)
I agree with all of the above and I write Java code for a living currently (Android/Dalvik though, not for the JVM).
Another cool aspect of the last point (Go being small and lightweight) is that if you've got gcc and mercurial on a supported platform, building latest go from source is as easy as:
hg clone http://code.google.com/p.go cd go/src ./make.bash
Got to build a local copy of the JVM and/or JDK for some reason? Good luck with that (even ignoring all the licensing, OpenJDK vs closed, etc)
I'm a Java-literate C/C++ programmer. I would avoid writing straight Java code at all costs; I find it immiserating. Here are some reasons off the top of my head that Golang is more pleasant to work in:
* The syntax is deliberately streamlined, including implicit declarations, semicolon insertion, lightweight expression syntax, the capital-letter-exports-a-symbol thing
* It has fully functional idiomatic closures
* Interfaces get rid of adapter class BS
* The table type (maps, in Golang) is baked into the language, like Python, not a library, like C++ and Java
* Clearer, more direct control over memory layout; data structures in Golang feel like C
I don't know if Golang's standard library is that much better than Java's, but it was obviously designed carefully by and for systems programmers, so I find it remarkably easy to work with.
It also feels like a much smaller system than Java. Almost every time I write a significant amount of Golang code, I find myself answering questions by just reading the standard library source code. It's easy to get your head around. I've written compiler/runtime-level code for the JVM and I still don't have a great grip on all of Java.