3 ms·
This is a known downside: rust forces you to write correct code, and will refuse to compile until you prove to it that you don’t have data races, all errors are
by e63f67dd-065b 4y ago
This is a known downside: rust forces you to write correct code, and will refuse to compile until you prove to it that you don’t have data races, all errors are handled, etc.
If it’s a one time script, I still whip out the trusty Perl one-liner, because correctness doesn’t matter.
I would argue, however, that the vast majority of software would benefit from the rust compiler. The type system is very powerful and modelling your problem in it lets you think about the problem explicitly and guarantees safety around its usage. You can refactor without worrying about the entire codebase breaking, and the doc and testing system is some of the best I’ve seen.
Rust lends itself naturally to writing large maintainable codebases, and I think that this is a much more important aspect that how quickly can you get the initial build out the door. Reliability is not just for the kernel and rendering engine.
- j1elo 4y ago> rust forces you to write correct code And to that extent, due to the lack of GC, you need to provide it (and keep in your head) with lots of extra information that wouldn't be needed with other languages. I find that Rust is too strict because it assumes concurrent multithreaded code by default. Which wouldn't be needed for most desktop apps. Why no circular refs or having a mut ref and a ref at the same time, in my simple single-threaded To-Do list Tauri app?
- tene 4y agoI disagree, and I'd be fascinated to hear more of your perspective here. I love Rust precisely because I can keep extra information out of my head. When I express something with the type system, I can stop tracking it mentally, and just rely on the compiler to keep track of it for me. With dynamic languages, I have to track far more mental state. "Mutable xor shared" does not have anything to do with concurrency or threads. Here's one example in the Rust Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=a6d5af0b8995603154e448e0fd4a167d https://play.rust-lang.org/?version=stable&mode=debug&editio... If this were permitted, then this example would have use-after-free whenever myvec reallocates its storage. No concurrency needed. I'm not sure what you have in mind for circular references, but I don't know of any complications with circular references that have anything to do with concurrency.