Why did I choose the Go language?

Recently, a reader of my book asked me why did you choose the Go language?. Here is a more elaborate answer. And, would I still choose it now?

July 17, 2019

Recently, a reader of my book asked me “why did you choose the Go language?”. I quickly mention it in the tools of the trade appendix. I will give a more elaborate answer to this question, and to the related question “would you still choose Go today?”.

Some of my initial motivations to choose the Go language were:

  • Fast compilation time (almost instant).
  • Fast run-time: at least on par with Java (it actually improved over the years).
  • Simple abstractions: easy to pick-up the language.
  • Try out a new language and see how good it is in practice.

I hesitated with Rust and Scala at the time. In hindsight, while I enjoyed the Go language features, I don’t think it was such a great choice. It was fast to pick up, but the language becomes a bit boring and sometimes, the lack of scientific libraries is an issue. I also find the error handling to be annoying, and the simplicity (lack of generics) a bit limitative.

Overall, the Go code is easy to read (big positive aspect), but it leaves a feeling that it does not look great (I know it’s very subjective). I am not so happy with the basic abstractions I used in my code. Furthermore, linear algebra is painful to read and write in Go (lack of operator overloading, partly).

In the past, I did a bit of Scala, and was much happier with the outcome (although the tooling was not particularly great at the time). I discarded Rust because I wanted something quick to start, and not spend too much time on the language itself. I had tried on a small example before and saw that the borrow checker was particularly picky. I think this was a mistake, since I believe that relatively quickly, I would have known how to program with the borrow checker in mind. Now, syntaxically, I do find some other people Rust code a bit scary, reminiscent of C++ code.

Today, I would pick Julia without hesitation. It is so relaxing to write linear algebra in Julia, even compared to Python. Powerful abstractions are possible. Programs are fast, compilation feels almost instantaneous (although you may need to be careful about the types then). There are good scientific libraries for Julia. Although some basic stuff is sometimes missing, for example, the bicubic interpolations available don’t implement analytic derivatives, it is already miles ahead of Java and Scala in this regard. And I expect it to catch up with Python quickly in the coming years.