What made you choose Rust over Go?

  • Error handling. In Rust it's easy and robust. You can't not handle an error. In Go it's a burden: if you don't remember to handle an error, it won't be handled. And of course it's if err != nil over and over again.

  • Non-nullable types are great too. I know exactly what's optional, and I know that if my program compiles, it won't blow up on an unexpected nil. In go nil keeps sneaking up on me, especially that structs can't enforce fields to be initialized. Which types can be nil is a mish-mash: I keep wanting nil strings for unspecified data, but nil maps that panic at insert cause me headaches.

  • No resource leaks. Drop guarantees things are always freed. There were times when I forgot to call defer foo.close().

  • Tight control over memory layout and allocation. I work on image processing, so when calling several functions per pixel it matters if they allocate, use dynamic interfaces or not. Go can work with this, but needs extra care, and lack of generics makes it harder to handle e.g. RGB and RGBA each in optimal way.

  • Rust slices and Vec are predictable. append in Go is bizarre. It's neither in-place, nor functional. If you call append(foo, …) it will work until it won't. bar := append(foo, …) looks like it's creating a new slice, but in unfortunate circumstances it may be overwriting beginning of another slice somewhere else!

  • Safe parallelism. Goroutines are easy to spawn, but not easy to guarantee they're correct in larger programs. Channels are nice for data streams, but not data-parallel problems. rayon rocks.

  • Ability to make static libraries. Products I develop end up being linked into various applications from desktop to servers, iOS and Android apps. Go is problematic in some of these environments.

  • For a while Cargo was much better than GOPATH. It's gotten better with go dep, but Cargo still feels more polished.

  • Go is undeniably a smaller and simpler language, but I guess I'm an advanced user, so I'm OK with a bit more complexity for convenience. For example, I love Rust's everything-is-an-expression, enums + match. In Go I feel like I'm stuck in the 1st gear.

30 Likes