Chapter 11. Mutation

 

Clojure’s main tenet isn’t the facilitation of concurrency. Instead, Clojure at its core is concerned with the sane management of state, and facilitating concurrent programming naturally falls out of that. The JVM operates on a shared-state concurrency model built around juggling fine-grained locks that protect access to shared data. Even if you can keep all of your locks in order, rarely does such a strategy scale well, and even less frequently does it foster reusability. But Clojure’s state management is simpler to reason about and promotes reusability.

Clojure Aphorism

A tangled web of mutation means that any change to your code potentially occurs in the large.

11.1. Software transactional memory with multiversion concurrency contr- rol and snapshot isolation

11.2. When to use Refs

11.3. When to use Agents

11.4. When to use Atoms

11.5. When to use locks

11.6. When to use futures

11.7. When to use promises

11.8. Parallelism

11.9. Vars and dynamic binding

11.10. Summary

sitemap