Go's friction points for me (and a comparison to Python)
A commentator on my entry on Python's data structures problem asked in part:
So, what's next, if anything? I take it Go wasn't a revolution in the way the migration from C to Python was. [...]
This brings up the complex issue of my views on Go. Part of the issue is that Go has a bunch of friction points right now. Some of them are intrinsic in the language and some of them are simply artifacts of the current situation and will hopefully change.
(I wrote more about where I think Go fits into my programming back in GoInterest.)
In general I don't think that Go will ever be as fast to program in as Python is (in the sense of how long it takes me to write a program, not in how fast it runs). Go goes to a lot of work to reduce the amount of bureaucracy involved through various features, but Python is simply at a higher level in terms of eliminating make-work and as a result it's significantly more flexible and adaptable. The tradeoffs involved are sensible for both languages and their goals; as discussed Go has a strong emphasis on large scale software engineering and Python doesn't.
(To put it one way, Go is a great language for large scale software projects but I almost never write those. As a sysadmin I'm generally a small scale programmer.)
I'm going to split this into current and intrinsic friction points, then do this in point form to keep the size of this entry from exploding. First, the current friction points:
- Go is not pervasively available in the way that things like Python,
Perl, and awk are. This is especially true of current versions
of the native Go toolchain, which is really what you want to be
working with. This is merely a pain for personal development (I
can always build the toolchain myself) but a relative killer for
work programming in our environment.
(To put it one way, 'first you download and build the compiler' does not make Go sound attractive to my co-workers.)
- Go's standard library is limited and portions of it are crazy. This
can be (somewhat) fixed with external packages but then I have to
find them and evaluate them and so on, which is a hassle. It would
be less of a hassle if people started making OS packages for various
good add on Go packages, the way many Perl and Python add-on modules
are only an
yumcommand away on most Linuxes.
(Part of why this matters to me is that
$GOPATHmakes me grind my teeth. It strikes me as such a bad fit for working with multiple projects under version control that it's painful.)
- The state of web frameworks for Go seems unclear right now. I
especially care about form handling and validation, especially
for database-backed forms (because this aspect is generally the
largest pain in the rear to code by hand; it's what drove me to
Django for my Python web app).
- Debugging is less friendly with Go than with Python, because if you screw up in Python it will dump out a great big verbose stack backtrace; often this points me to exactly the mistake I made. Go is a lot terser and thus less helpful.
(There are also pragmatic issues with using Go in production.)
I thought that I had several intrinsic language issues but at this point all I can think of is the general extra annoyance of explicit error handling as opposed to Python's tacit exceptions. I understand why Go makes the choice it does but Python's exception-based approach is just plain convenient for quick coding and it means that you can write much less code (you can aggregate error checks and even skip writing explicit ones and your program will still abort on errors).
(I consider things like Go type assertions to be part of the general price paid for static typing. I can't really describe static typing as a friction point, although to be honest it sort of is.)
Also, as I've written before I maintain that Go's
obsessive focus on goroutines with basically no support for
et al is ultimately a mistake. Goroutines cannot do everything and there
are real situations that they don't cope with (not unless you allow
them to be canceled from outside while they are in nominally blocking
(If I use Go more I may find some additional irritations. Python is a relatively featureful language as compared to Go, so I may find myself missing things like function decorators at some point.)