4 ms·
No modern language I know of beats Haskell’s support for STM: https://wiki.haskell.org/Software_transactional_memory https://wiki.haskell.org/Software_transact
by hardwaresofton 4y ago
No modern language I know of beats Haskell’s support for STM:
https://wiki.haskell.org/Software_transactional_memory https://wiki.haskell.org/Software_transactional_memory
As I always say, Haskell is the Mercedes of programming languages.
- kortex 4y ago> Haskell is the Mercedes of programming languages. Comfortable, packed with features, pretty fast given its weight, kind of elitist yet approachable if you invest time in it? :p
- hardwaresofton 4y agoding ding ding! Also something about inventing/spurring mass adoption of airbags and ABS. Safe and fast.
- the-alchemist 4y agoI don't have much experience with Haskell, but Clojure also has STM out-of-the-box. I don't know if it's the approach described in paper, but it's quite fast. It's probably made faster by the fact that almost all data in Clojure is immutable. "The Clojure STM uses multiversion concurrency control with adaptive history queues for snapshot isolation, and provides a distinct commute operation." https://clojure.org/reference/refs https://clojure.org/reference/refs, for the curious and brave
- dkersten 4y agoInterestingly, I’ve been using Clojure since 2009 and I’ve never once used STM (outside of playing around to learn how to use it). I’ve used agents on occasion, I’ve used atoms, I’ve used core.async a lot, but refs and STM, to me (ie YMMV) seem like one of those things that seemed like a useful great idea, that in practice just wasn’t really necessary. Maybe others have had a different experience, of course. This is just an observation about my own code and the libraries I use.
- KingMob 4y agoNo, your assessment is pretty accurate. I've only encountered refs once in the wild, and only because it was too much hassle to refactor working code to use an atom. It turns out that updating a single storage point in an atom with a CAS serves 99.9% of use cases, and is much, much simpler than ref-based code.
- ParetoOptimal 4y ago> but refs and STM, to me (ie YMMV) seem like one of those things that seemed like a useful great idea, that in practice just wasn’t really necessary. Haskellers (including myself) tend to default to STM to take advantage of atomicity. Of course it's easy to make the safe choice when the shared interface between concurrency primitives make switching very low cost. More: https://www.oreilly.com/library/view/parallel-and-concurrent/9781449335939/ch10.html https://www.oreilly.com/library/view/parallel-and-concurrent...
- fmakunbound 4y agoCommon Lisp has it too, via https://stmx.org/ https://stmx.org/ I believe it supports the Intel TSX stuff if present and falls back to a software implementation if not present.
- jasonincanada 4y agoI have a repo with six sample algorithms of increasing complexity: https://github.com/jasonincanada/stm-haskell https://github.com/jasonincanada/stm-haskell