5 ms·
I have never done anything in Rust. Are there any benefits? Any drawbacks?
by inherentFloyd 8y ago
I have never done anything in Rust. Are there any benefits? Any drawbacks?
- gf263 8y agoYes
- bluejekyll 8y agoI read this nearly four years ago, and it convinced me (based on a lot of experience with bugs in concurrent code) to dedicate a significant portion of my spare time learning and using Rust: https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.html https://blog.rust-lang.org/2015/04/10/Fearless-Concurrency.h...
- cpeterso 8y agoHere's a great talk (from Strange Loop conf 2017) by David Sullins about Rust concurrency: https://youtu.be/oIikwmeGVYY https://youtu.be/oIikwmeGVYY
- gnuvince 8y agoIf you don't mind a bit of a re-education, Rust allows you to write programs that are as fast as those written in C or C++ and you'll be more confident that they don't have strange memory bugs. (Reason: the ownership model of Rust prevents a lot of bugs that are found in C or C++, but this model also rejects many correct programs, so you need to re-learn how to write some programs.)
- wwright 8y agoOne thing people (like me ) often say is that it forces you to “learn to write better.” One way you can think of it is this: - Rust rejects some programs that are truly wrong (`“2” + 3` style) - Rust rejects some programs that really are just fine. They are actively improving this with stuff like “Non-lexical lifetimes.” - Rust rejects some programs that are fine _how they are now_, but which are hard to keep fine when you change them. This is part of why linked lists are hard to write in Rust :-)
- gnuvince 8y agoI admit that I'm very unexcited about non-lexical lifetimes—the cost-to-benefit ratio seems worse than the current model. The current lifetime system is simple to understand: a value is live until its owning variable goes out of scope. It can be a bit restrictive sometimes (though it seems that after a while you learn how to work around those issues easily enough), but it's easy to keep in your head and reason about code. With non-lexical lifetimes, I think that we'll have a harder time understanding lifetimes, it'll be more difficult to teach them and to debug them.
- wwright 8y agoMy understanding is that the semantics are exactly the same, but it’s just possible for the checker to match your intent more tightly. For example, in lexical lifetimes, this fails: let x = &mut foo; if x.bar() { baz() } else { foo.consume() // takes foo by value } It will complain that you’ve used `foo` while it is borrowed by `x`, even though a human can easily tell that `x` is already irrelevant by that point. NLL would accept this (I believe).
- bytematic 8y agoIt is a great language. You will fight with the compiler, it will do its best to tell you whats wrong, and finally when it fully compiles with no errors, you pretty much never have to worry about the program in runtime.
- dbrgn 8y agoIf you don't mind going through a 40-page free e-book from O'Reilly, I can strongly recommend this: https://www.oreilly.com/programming/free/why-rust.csp https://www.oreilly.com/programming/free/why-rust.csp (Direct link: https://www.oreilly.com/programming/free/files/why-rust.pdf https://www.oreilly.com/programming/free/files/why-rust.pdf) It explains the concepts and strengths of Rust in a very easy-to-understand way. (Jim Blandy is also the Author of the O'Reilly Rust book.)
- jeffdavis 8y agoOne cool thing is that you can use it almost anywhere -- an OS kernel all the way up to a game compiled to WebAssembly to run in the browser.