jargon

Comparison

ImmutabilityvsImmutable update

Immutability

nothing that was handed out can be changed, so you stopped copying defensively and stopped worrying about who else holds it.

Building values that cannot change after construction, so a change produces a new value instead. It removes aliasing bugs, makes equality and hashing safe, makes objects shareable across threads without locks, and makes change detection a reference comparison. The costs are allocation and awkwardness in the places where a large structure genuinely does change often, which is what persistent data structures address.

Full entry →

Immutable update

you built a new array with the change in it instead of pushing onto the one you already had.

Producing a new value rather than mutating the existing one, so that a shallow comparison can detect the change. It is not an aesthetic preference in a component framework: mutation in place is invisible to change detection, so the update simply does not render. The cost is allocation and the awkwardness of deep updates, which is what libraries with a draft-based API exist to hide.

Full entry →

Related comparisons