jargon

Comparison

DeterministicvsReferential transparency

Deterministic

you run it twice with the same input and get byte-identical output, because nothing inside it reads the clock or a random number.

The property that the same inputs always produce the same output. It is about reproducibility, not about repeat-safety: a deterministic function can still be unsafe to run twice if it has side effects, and an idempotent operation can be non-deterministic in what it returns. Determinism is what makes replay, caching and testing possible.

Full entry →

Referential transparency

you replaced the call with the value it returned and the program behaved identically, which is not true of most calls.

The property that an expression can be replaced by its value without changing the program's meaning. It is the formal statement of what purity buys, and it is the licence under which memoisation, common subexpression elimination and lazy evaluation are all safe. It is the thing that quietly stops being true the moment a function reads the clock or a global.

Full entry →

Related comparisons