Hacker News new | ask | show | jobs
by khgvljhkb 3846 days 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).

3 comments

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

Tangential: 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/

And the classic KiranDave/Aphyr vs Ryah thread on "NodeJs Concurrency" https://news.ycombinator.com/item?id=4306241

I guess the wordcount process cannot be done with immutable structures? at least not on the same memory footprint, or at the same speed
What do you mean?