3 ms·
I think the amount of code you need to maintain and simplicity are orthogonal things. When we say go is simple, what we usually mean is that by looking at a bit
by t8sr 3y ago
I think the amount of code you need to maintain and simplicity are orthogonal things. When we say go is simple, what we usually mean is that by looking at a bit of code, it's obvious what it does. There's no way that `x + y` can be anything other than addition, or `f(x)` anything other than a function call. It also means, that only function calls can hide additional complexity. You could also talk about lexical proximity to things that can affect the outcomes.
By that metric, Rust is complex. Looking at a piece of code, it could do basically anything at all. It can get rewritten by a macro, operators can be overloaded, any line of code can hide implicit magic that you have no way of knowing about.
Rust gets away with being complex by having lots of correctness checks. C++ is about as complex as Rust, but, without the correctness checks, it can be a nightmare. In Rust, it might be hard to tell what happens when you run some code, but at least you know it will be nothing terrible.
what does simple mean?
1) Simple for me, writing the code
2) Simple for you, reading the code
3) Simple for the SREs who have to operate the code
4) Simple in the sense that there aren't many abstractions
5) Easy to refactor
6) Easy to use and test (a function is simpler than a bunch of objects)
7) Simple to debug (no state is simpler than yes state)
Both Go and Rust score pretty high in aggregate on these different definitions of simple, but they get there in very different ways.
- stouset 3y agoMy stack ranking of Go / Rust along these axes: * writing # Go > Rust * reading # Rust > Go * operate # Go = Rust * abstraction count # Go >> Rust # refactoring # Rust >> Go # testing # Rust > Go # debugging # Rust >> Go Obviously these are my own opinions, yours may differ. The underlying theme here for me: Go is somewhat easier to write right out of the gate but significantly worse to maintain. Once Rust is written it is bulletproof. Refactoring is trivial to a degree that's hard to believe if you haven't done it. Since code is read and maintained significantly more often than it's written… you can probably guess where I end up.