Comment on Why should I use rust (as a Go enthusiast)?
r1veRRR@feddit.de 1 year ago
Ironically, I learned Rust first, and later looked at Go. I found a lot of the syntax needlessly “different”. That being said, it’s still a decent language. Point being, a lot of the weirdness subsides once you understand why it’s there.
Personally, I don’t actually care about the lifecycle and memory management stuff. What I like about Rust is:
- An enforced error type that is very convenient to use with the ? operator. No more err != nil spam, but same amount of safety
- ADTs with a host of wonderful features, like exhaustive match statements. Go enums are horrendously basic, let’s be honest
- NO NIL!! Non existence is expressed with an Option type that, like the error type, comes with many conveniences
- Generics from the start, meaning you don’t have older code that throws away type safety anywhere
- Traits/Interfaces can be implemented for foreign/external types and types can implement external interfaces (duh)
- Great tooling, good formatting tools, good LSP, that kind of stuff. Golang has that too
Why learn Rust? For the same reason everyone should learn different languages. To learn new concepts and see new perspectives on old problems. It’ll make you a better developer even in your previous languages.