3 ms·
Rust and Go are not readily comparable. Rust is a systems language aimed at the same domain as C++ and, to an extent, C. Go is more akin to Java and Python. ESR
by mcguire 10y ago
Rust and Go are not readily comparable. Rust is a systems language aimed at the same domain as C++ and, to an extent, C. Go is more akin to Java and Python. ESR almost admits this:
"Latency and soft-realtime performance
"Again, zero-overhead abstractions and no stop-the-world GC pauses give Rust a clear +1.
"It is worth noting that Go came nearest disqualifying itself entirely here. If it were not possible to lock out Go’s GC in critical regions Rust would win by default. If NTP’s challenges tilted even a little more towards hard real time, or its critical regions were less confined, Rust would also win by default."
As an aside, if ESR couldn't get Rust's ownership model, I wonder how long it took him to internalize how not to write memory bugs in C?
- baq 10y agoi guess it was in a way easier because the C compiler doesn't call you names if you make a subtle bug and rustc states its opinion about your work in no uncertain terms. it's harder to get going in rust, but once it goes, it usually doesn't stop.
- tikhonj 10y agoUnless you read segfaults and core dumps as insults, of course :).
- bjz_ 10y agoYou learn to love the compiler. It becomes a symbiotic relationship, and the cycle times for refactors and debugging are short because you get such quick up front feedback. Your productivity certainly takes a hit initially though.
- drbawb 10y agoA symbiotic relationship is an apt way to phrase it. Most of my invocations of rustc aren't even to actually compile an executable. Typically I'm running something akin to a cargo-check[1] to ask rustc some questions about my codebase: What type did you infer for this binding? Are these generic bounds precise enough? How long can I keep this reference around? In C++ I loathe generic programming, a template instantiation error is something I fear. Whereas in Rust I knowingly compile broken generic code all the time, because the errors are (usually) good enough to help me fix it. [1]: https://github.com/rsolomo/cargo-check https://github.com/rsolomo/cargo-check
- jug 10y ago> Rust and Go are not readily comparable. Rust is a systems language aimed at the same domain as C++ and, to an extent, C. Go is more akin to Java and Python. In a sense yes, although Go compiles to native code and offers completely different performance compared to an interpreted language like Python, and no JIT warmup periods of JIT compiled languages, and no dependencies on runtime environments or virtual machines, and from the outside runs confusingly similar to a native C application. Also, C/C++ is such huge languages that they are in use in _far_ more scenarios than low level systems programming. Maybe that was the intention when they were designed, but usage exploded on e.g. Windows before the days of .NET and many still prefer it over .NET due to performance. Even if these are then desktop applications using Win32, Qt, or even MFC. C is also heavily used in development of e.g. GNOME applications with GTK+. Also a huge field of non-system level desktop applications. C / C++ is also usually preferred for games development. This is why I think there's room for Go even in the context as a C/C++ successor simply because of the field where C/C++ is used is just so darned huge, although I do agree that if the application here is a close-to-metal application where you don't have time to wait more than a millisecond on a garbage collector or need complete control over memory use, Rust may be more useful and in this sense yes, be more like a spiritual successor to C as well.
- cakoose 10y ago> As an aside, if ESR couldn't get Rust's ownership model, I wonder how long it took him to internalize how not to write memory bugs in C? Rust's type system, like any type system, is limited. It enforces a certain style of safe programming and will reject other styles of safe programming. The compiler is also not great at explaining why something is wrong. I'm not knocking the compiler writers, because it's a hard problem and they're putting serious effort into it. But from ESR's perspective, he's writing code that is safe (according to a style he's developed over decades of programming) only to have it rejected with an explanation that doesn't make sense. It's frustrating. There are ways to improve the learning experience. You can improve documentation, improve compiler error messages, and improve the type system itself (e.g. non-lexical lifetimes). The Rust team appears to be taking all of these seriously. I think the people who make it past the initial frustration are those who believe that it will be worth it. I'm a huge fan of type safety guarantees. I've also followed the development of Rust enough to know that the people making decisions are good at designing languages. So when I'm frustrated, I remind myself that this is probably all worth it. But reading ESR's write-up, he's clearly not coming from the same place. He believes that Go and Rust both have "strong type systems", which is clearly false. He complains about Rust exposing an unsafe construct like mutexes without realizing that Rust mutexes are much safer than in C. But to be fair, he's also thinking about a specific project that needs an efficient epoll-style mechanism and Rust is just not there quite yet.