5 ms·
Whenever I read an article like this about Rust, I thank my lucky stars I don’t have to work with it on a daily basis. Same for C++. It seems like so much effor
by camdenlock 4y ago
Whenever I read an article like this about Rust, I thank my lucky stars I don’t have to work with it on a daily basis. Same for C++. It seems like so much effort is wasted just trying to appease the compiler that it makes building actual functioning applications a major chore, especially when it comes to library interop.
And yet there are large projects built in Rust, so there apparently are people out there who enjoy what appears to me to be significant suffering…
- the_mitsuhiko 4y agoRust is excellent if you don't touch the bits that don't lead you anywhere. I'm quite confident that on a daily basis you can quickly learn to avoid the bits where you won't be successful. I feel quite productive in Rust and the language gives me a lot of joy.
- josephcsible 4y agoAppeasing the compiler is the wrong way to think about what you're doing. Think of it instead as proving that your code doesn't contain any memory corruption bugs.
- pornel 4y agoIn real programs this whole thing is avoided by adding a single boolean or a second method. This article isn't an example of what anyone should be doing, but an exploration of how one can stubbornly push the language to the limit to work around a missing feature. It's Rust's equivalent of preprocessor abuse.
- pjmlp 4y agoActually I keep using both for hobby coding, and muss confess I rather lean on C++ side even with its C inherited unsafety due to stuff like this, and the ecosystem naturally.
- ben-schaaf 4y agoC++ 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.