←back to thread

193 points ingve | 4 comments | | HN request time: 0.413s | source
Show context
ilrwbwrkhv ◴[] No.43712785[source]
Rust has a bunch of these while being maintainable.
replies(4): >>43713075 #>>43714151 #>>43714332 #>>43724210 #
1. mrkeen ◴[] No.43714151[source]
STM is Haskell's feature for safe shared&mutable state.

What is Rust's feature for safe shared&mutable state?

replies(2): >>43715359 #>>43715749 #
2. speed_spread ◴[] No.43715359[source]
That would be Arc<Mutex<T>>, which works but is no STM.
replies(1): >>43715788 #
3. zozbot234 ◴[] No.43715749[source]
Relevant: 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.)
4. Philpax ◴[] No.43715788[source]
Additionally, the actor model is pretty easy to implement: https://ryhl.io/blog/actors-with-tokio/