Hacker News new | ask | show | jobs
by odipar 1821 days ago
I think immutability (or immutable state) adds one big advantage over mutable state: you have access to previous state(s) and the current state.

Immutability is very convenient for checking post-conditions that compare previous states and the current state for certain properties that should hold (temporal properties for example).

In turn, post-conditions guard your states to be sane.