3 ms·
STM is Haskell's feature for safe shared&mutable state. What is Rust's feature for safe shared&mutable state?
by mrkeen 2y ago
STM is Haskell's feature for safe shared&mutable state.
What is Rust's feature for safe shared&mutable state?
- speed_spread 2y agoThat would be Arc<Mutex<T>>, which works but is no STM.
- Philpax 2y agoAdditionally, the actor model is pretty easy to implement: https://ryhl.io/blog/actors-with-tokio/ https://ryhl.io/blog/actors-with-tokio/
- zozbot234 2y agoRelevant: https://github.com/Marthog/rust-stm https://github.com/Marthog/rust-stm which has usage instructions. It's memory safe as defined in Safe Rust, but unlike the Haskell implementation it's not "safe" in a correctness sense, because Rust does not afford the same control about mutability and purity. (At least, not yet - future additions to the language may improve this somewhat.)