3 ms·
In the absence of Rust, would C or C++ be top contenders for a given project? Then Rust might be a good fit. If the contender language is Go, think carefully b
by code_biologist 4y ago
In the absence of Rust, would C or C++ be top contenders for a given project? Then Rust might be a good fit.
If the contender language is Go, think carefully before using Rust.
If the contender language is Python, think very carefully before using Rust.
- fakedang 4y agoLol, that's pretty much the heuristic I have been going by. Rust to replace C++ and Julia to potentially replace Python as it matures.
- MaulingMonkey 4y agoThis was roughly my own intention, although I've ended up going all in on Rust and using it even for that which it isn't particularly suited for. Web frontend dev? Stay in JS-land instead of distracting yourself with a WASM sideshow like I do (unless you really need the clientside perf.) Throwaway scripts? Creating a cargo package is a bit overkill, although I do so anyways. The standard APIs can be a little less ergonomic, but that's nothing wrappers can't help with. Rust does an excellent job of providing fairly comprehensive opt-out safety, compared to C++'s hodgepodge of incomplete, edge case laden, compiler and tool specific, opt-in static analysis and annotations. Even a C++ skeptic like myself can learn a lot about how terrible the language is, by trying to write the same code in Rust and learning exactly why the borrow checker is complaining. But it's also a very front-loaded knowledge bomb, with a nasty learning curve. It took me a good month or two to stop fighting the borrow checker and embrace clones and RefCells. Perhaps a less painful learning curve than debugging C++ gone wrong, but certainly more painful than a lot of other non-systems languages - I doubt it'd make a good 1st programming language. Arrogance means you'll shoot yourself in the foot with `unsafe { ... }` escape hatches as well, and end up debugging memory issues anyways. Web and gamedev ecosystems are still weak for my tastes, although improving. I want a nice existing successful fun game to contribute to, that's written in Rust, so I don't have to find the motivation to RIIR an existing one or write my own. Also little point in statically proving to the compiler that your code is totally fine and safe if your bugs are already shallow through testing. I feel little desire to rewrite a typical C# codebase in Rust - what the borrow checker can catch, so too can proper unit tests, for the most part. Maybe invest in some code coverage analysis for CI instead. Unless those GC pauses are actually causing problems... or you have enough data races from missing mutexes in your multithreading code...
- yangcheng 4y agoDropbox did rewrite their python codebase with rust. Not sure if that considered as a contender
- pclmulqdq 4y agoDropbox's use of python was a very weird choice. At the time, other distributed filesystems were written in C++. It makes a lot of sense to move to rust.