3 ms·
Do you have any specific examples of this (or the fine print that implies it) for Rust? (Not sealioning[0], genuinely interested!) [0] https://www.merriam-webs
by moosedev 4y ago
Do you have any specific examples of this (or the fine print that implies it) for Rust? (Not sealioning[0], genuinely interested!)
[0] https://www.merriam-webster.com/words-at-play/sealioning-internet-trolling#:~:text=Sealioning%20refers%20to%20the%20disingenuous,questions%20of%20the%20other%20commenter https://www.merriam-webster.com/words-at-play/sealioning-int....
Edit: Just realized you said "even with garbage collection", so you weren't talking about Rust. Never mind.
- tialaramex 4y agoThat's actually an entirely reasonable question, Rust's memory model is scarcely as well nailed down as the Java Memory Model (which is a GC model that does promise memory safety under concurrency and is worth reading about if you'd like to see how much thought is needed). https://jcp.org/aboutJava/communityprocess/final/jsr133/index.html https://jcp.org/aboutJava/communityprocess/final/jsr133/inde... (section 17.4 of the full specification) However in a sense Rust is cheating. Java has to do a lot of work because they can't stop you writing a data race in Java, so they want that to be safe anyway if it happens. (Safe) Rust just won't emit the data race in the first place. A data race requires (as mentioned below in the thread about Python concurrency) that there's mutation concurrently with access to the same memory. In Java that's a bad idea, but it does happen, usually by mistake. In (Safe) Rust mutation requires that nobody else has a shared (immutable) reference to the object, so the data race can't occur because if we can mutate something by definition nobody else has a reference to it - programs with this mistake won't compile.
- moosedev 4y agoThank you!