3 ms·
I'd rather have immutable data, and no shared state in concurrent apps, but to each and their own. Just remember that there is no big conceptual difference bet
by khgvljhkb 11y ago
I'd rather have immutable data, and no shared state in concurrent apps, but to each and their own.
Just remember that there is no big conceptual difference between blocking and locking, which is what you end up doing when having shared mutable state.
Recommending anyone to check out CSP (like in Go & Clojure/script (the latter also with immutable data)) or Actors (like in Erlang, Elixir).
- pcwalton 11y ago> Just remember that there is no big conceptual difference between blocking and locking, which is what you end up doing when having shared mutable state. Conceptually, yes, but the incredibly low overhead of CPU atomics compared to message passing (especially on x86) mean that theory and practice are very different.
- lucio 11y agoI guess the wordcount process cannot be done with immutable structures? at least not on the same memory footprint, or at the same speed
- khgvljhkb 11y agoWhat do you mean?
- ignoramous 11y agoTangential: A discussion on STM vs Locks between Cliff Click (Cheif JVM Engg at Azul Systems back then) and Rich Hickey (of Clojure fame): http://h2o.ai/personal/2008/05/clojure-stms-vs-locks/ http://h2o.ai/personal/2008/05/clojure-stms-vs-locks/ And the classic KiranDave/Aphyr vs Ryah thread on "NodeJs Concurrency" https://news.ycombinator.com/item?id=4306241 https://news.ycombinator.com/item?id=4306241