3 ms·
I still don't get it... And the previous sentence is now confusing for me too :) First you showed two examples: Arc (to share immutable data) and RWArc (to sha
by ash 13y ago
I still don't get it... And the previous sentence is now confusing for me too :)
First you showed two examples: Arc (to share immutable data) and RWArc (to share mutable data with enforced mutexes around closures). Then you talked about `unsafe`. Seems easy, one needs a "backdoor" to implement RWArc in Rust (at first I thought it was implemented in C/C++).
But (quoted) sentences between Arc/RWArc part and `unsafe` part don't really connect them, at least to me.
- steveklabnik 13y agoHa! Bummer, maybe I will just need to re-write this paragraph. A RWArc is shared mutable state: you can have two references to the Arc in two different tasks. Yet I said that Rust throws a compiler error for shared mutable state. > (at first I thought it was implemented in C/C++). There's very little C++ in Rust anymore. :) > Seems easy, one needs a "backdoor" to implement RWArc in Rust Yup, this is exactly the point with those two sentences. Maybe I should just straight-up remove them.
- ash 13y ago> Maybe I should just straight-up remove them. Or be explicit that you'll now talk about RWArc implementation.
- deckiedan 13y agoYes. This. I found it a bit worrying, as when I read that I had to go back and re-read the code a few times to make sure that there wasn't an unsafe block in the code, or perhaps that the use of RWArc implied unsafe, and would then turn that whole function into an automatically unsafe block. Nevertheless, very cool. I really liked the tutorial, I'm getting quite excited by Rust.
- dbaupp 13y ago> There's very little C++ in Rust anymore. I think we've now got none, except for LLVM in the compiler, which means any binaries built using the stdlib don't need any C++ libraries (to be clear, libraries without the stdlib have never needed any).