Hacker News new | past | comments | ask | show | jobs | submit login

Multicore is there, STM instead of mutable imperative logic in all the libraries developed for the past two decades: not so much though.



Still early days, but I had done some exploratory work in the past on Reagents, a composable lock-free library [1]. Now that OCaml 5 is released, we're reviving this work.

It's semantics is weaker than STM -- unlike STM, it doesn't provide serializability but Reagents can compile down to multi-word compare and swap operations, which can be implemented with the help of hardware transactions (when present) or efficient software implementations of it [2]. Hence, Reagent programs should be faster than STM.

[1] https://github.com/ocaml-multicore/reagents [2] https://arxiv.org/pdf/2008.02527.pdf


I haven't heard anyone talk about STM for OCaml, funny. People talk about, or work on, lightweight fibers, lockfree data structures, io_uring, etc. but not STM. Is it falling out of fashion? Even in clojure I hear that few people actually use it.


It works great in Haskell. The problem is that it really needs typed effects, hopefully OCaml will get typed algebraic effects at some point.




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

Search: