Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

STM is Haskell's feature for safe shared&mutable state.

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



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.)


That would be Arc<Mutex<T>>, which works but is no STM.


Additionally, the actor model is pretty easy to implement: https://ryhl.io/blog/actors-with-tokio/




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: