Ep 041: Why do Clojurians make such a big deal about immutability?
Each week, we answer a different question about Clojure and functional programming.
This week, the question is: “Why do Clojurians make such a big deal about immutability?” We cover several practical side effects of immutability and why we’ve become such big fans of data that doesn’t let us down.
- “Well, we don’t have Monads to talk about.”
- “What good is a program, if you can’t change stuff!?”
- “The memory cost of data structures is in proportion to the changes, not the users.”
- “I can hang on to a reference to the old state and a reference to the new state very cheaply.”
- “You can reduce comparison to referential equality.”
- “Once you can efficiently save every version of the state, going back to a previous version is no big deal.”
- “I love determinism. Determinism is trustable.”
- “I can trust immutable data. And if I can trust it, then it can occupy a smaller part of my brain.”