2 ms·
C++ and rust are not really comparable here; C++ is pretty close to most other statically typed languages like Java, TypeScript, etc. So in terms of spending lo
by ben-schaaf 4y ago
C++ and rust are not really comparable here; C++ is pretty close to most other statically typed languages like Java, TypeScript, etc. So in terms of spending lots of time appeasing the compiler from my experience that's plainly not true. Orders of magnitude more time is spent debugging why your code is wrong despite it compiling. On top of that almost every time it doesn't compile it's a bug in your code; as is the nature of static type checking. C++ is difficult to write because you're navigating a minefield of undefined behavior, expensive copy constructors and manual memory management; not because of compiler errors.
Rust has taken a trade-off here, where you get more cases of "appeasing the compiler" but significantly more bugs caught at compile time. Memory and concurrency bugs can be extremely hard to debug or even reproduce, so a language that lets you avoid most of those is a positive for productivity.