3 ms·
I actually doubt Rust puts the memory _model_ first, but it provides a path through which you effectively don't have to worry about it at all. Which is wonderfu
by Manishearth 11y ago
I actually doubt Rust puts the memory _model_ first, but it provides a path through which you effectively don't have to worry about it at all. Which is wonderful and good enough, really.
IIRC Rust has a similarly confusing underlying memory model. However, due to a lack of direct shared mutable state being available, you don't get to see this often. In fact, one might call Rust's model more confusing than C++ since you have `noalias` everywhere which can enable more aggressive optimizations. But it's mostly irrelevant since you don't deal with it unless you're writing unsafe code.
On the "encourage new devs to read the Rust docs" front I agree, though. We've had tons of people saying that they code better C++ after learning Rust. Also I've heard of companies wanting to start programming in C++/Rust-y things with a majority of python/ruby/js/etc devs use Rust because "Rust teaches a lot of things to the programmers that they no longer have to". Something like that.
- kibwen 11y ago> IIRC Rust has a similarly confusing memory model In fact I believe that at a fundamental level Rust is forced to more-or-less adopt C11's memory model thanks to its usage of LLVM, though, as you say, Rust's concurrency safety mechanisms mean that the theoretical soundness issues that apply to C11 are toothless in Rust.
- easytiger 11y agoAgreed. What i meant was they start talking about the memory model at the very beginning of their online book, more than most languages bother with. https://doc.rust-lang.org/book/the-stack-and-the-heap.html https://doc.rust-lang.org/book/the-stack-and-the-heap.html
- steveklabnik 11y agoYeah, this is because we want people who may not have a systems backround to be able to use Rust. That's just general info on the concept of stack vs heap, it's not Rust-specific.