Chapter 6. State and the concurrent world

This chapter covers

  • The problems with mutable state
  • Clojure’s approach to state
  • Refs, agents, atoms, and vars
  • Futures and promises

State—you’re doing it wrong.

Rich Hickey[1]


From a presentation at the Boston Lisp meeting, 2012,

The preceding quote is from a presentation by Rich Hickey in which he discusses Clojure’s approach to concurrency and state. He means that most languages use an approach to modeling state that doesn’t work very well. To be precise, it used to work when computers were less powerful and ran programs in a single-threaded fashion, but in today’s world of increasingly multicore and multi-CPU computers, the model ...

Get Clojure in Action, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.