3 ms·
Dramatically more so. Rust is complex, but most (not all!) of the complexity is there to support a specific, modern, safe style of programming. C++ adds fifty
by Filligree 3y ago
Dramatically more so. Rust is complex, but most (not all!) of the complexity is there to support a specific, modern, safe style of programming.
C++ adds fifty years of cruft to that.
A lot can be said about the surrounding social environment, but as far as the languages go, I don't think it's far wrong to say that Rust is "C++: The good bits".
- ReactiveJelly 3y agoYeah I guess I'd phrase it as 3 kinds of "complexity" Rust is complex because the compiler has many ways to say "No I won't compile that, it might be wrong". C++ is complex because it requires the programmer to understand every feature used in the codebase. (e.g. Will the compiler warn me if I use inheritance and dynamic dispatch wrong? I'm not sure. I find code with inheritance hard to read.) Go _code_ is complex because the language is too simple. (if err != nil is waterbed complexity)
- Sohcahtoa82 3y ago> Rust is complex because the compiler has many ways to say "No I won't compile that, it might be wrong". Doesn't Rust have an escape hatch in the form of the "unsafe" keyword for cases where you're reasonably sure the code is safe and correct? I haven't used Rust and most of my knowledge of it comes from HN, so I could easily be wrong.
- Filligree 3y agoIt does, which is where the social aspect comes in: You're expected to make every reasonable effort not to use it, even if that comes at slight costs in performance, because practically speaking people are terrible at making those judgements. Sometimes works well. Sometimes, unfortunately, it leads to bullying.
- Sohcahtoa82 3y agoI always pictured that in a professional setting, engineering management would have an edict that `unsafe` is simply not allowed, or possibly, they allow it with extensive code review by multiple engineers. And that there would also be a lot of people trying to implement a double-linked list and finding themselves having to sprinkle "unsafe" all over the place to satisfy the borrow checker.
- Filligree 3y agoBoth of those happen. Though in practice, unless you’re specifically implementing basic infrastructure, I’ve never yet had any need to use unsafe.
- justincredible 3y ago[dead]
- marcosdumay 3y ago> C++ adds fifty years of cruft to that. If "that" refers to the support of a modern, safe style of program, then no, C++ has only the cruft, not that.