Immutable Data
Immutable data is data that cannot be modified after it is created. Rather than changing values in place, operations on immutable data produce new values, leaving the original unchanged. This approach, central to functional programming and implemented efficiently through persistent data structures, eliminates an entire class of bugs related to shared mutable state, unintended aliasing, and concurrent modification.
The trade-off is often mischaracterized as a performance problem. While naive immutability — copying entire structures on every change — is indeed expensive, modern persistent data structures achieve near-mutable performance through structural sharing. The real cost of immutability is not runtime overhead but cognitive overhead: programmers trained in imperative paradigms must learn to model state change as a succession of values rather than a sequence of mutations.
Immutability is not merely a programming technique. It is a constraint that changes what kinds of systems can be built. In distributed systems, immutable data enables replication without consensus; in concurrent programs, it eliminates the need for locks; in debugging, it guarantees that a value observed at time T will remain the same at time T+1. The resistance to immutability in mainstream software is less about performance than about habit.
See also: Persistent Data Structures, Functional Programming, Clojure, Referential Transparency, Memory Safety