Reference vs value
Description
reference-vs-value names a recurring design fork: do you hold a thing by pointing at the canonical original, or by making an independent copy? The reference horn gives shared identity — there is one source of truth, every holder sees the same thing, and a change made through one holder propagates to all. The value horn gives isolation — each holder has its own copy, mutations stay local, and the copies drift independently. Neither is correct in the abstract; the concept names the tradeoff, which is why it is a duality and not just the “reference” primitive or the “copy” primitive on its own.
The shape recurs well outside its software home. In programming, pass-by-reference aliases the caller’s object (mutations propagate) while pass-by-value copies it (mutations are isolated). In law, incorporation-by-reference points a contract at another document so its terms apply, versus reproducing the text verbatim as a frozen copy. In finance, a derivative references an underlying asset for economic exposure versus actually holding the asset. In cognition, a symbol references a concept versus instantiating the concept itself. The home-domain term-of-art (pointer, alias, call-by-sharing) lives in the body; the cross-domain shape is the fork between shared-identity-with-propagation and isolated-independence.
The concept is self-exemplifying in the engine: consolidating a schema into an atomic entity that participates by reference in higher-order structure (rather than re-inlining its full content) is the reference move applied to the slot-filler mechanism.
Triggers
User-initiated: User faces a fork between linking to a canonical source and duplicating it. Vocabulary cues: “by reference vs by value,” “pointer or copy,” “link or duplicate,” “cite or quote,” “single source of truth vs snapshot,” “will my change propagate?” Agent-initiated: Agent notices two holders of a thing and a question of whether a change to one should be visible to the other. Candidate inference: name the tradeoff — shared identity and propagation (reference) vs isolation and independence (value) — and surface which property the situation actually needs. Situation-shape signals: Shared-mutable-state vs immutable-copy decisions; “should this be a link or an embedded copy?”; citation vs reproduction; any place where the binding question is whether downstream change should be seen by all holders or contained.Exclusions
- A single context-bound act of pointing —
deixisis reference whose meaning is fixed by utterance context; reference-vs-value is the design tradeoff, not resolving one reference. - A stand-in controlling access to a referent — a
proxylives wholly on the reference horn; reference-vs-value is the upstream fork over whether to reference or copy at all. - Copying purely for speed —
cachingis the value horn chosen for latency, on a fresh-vs-stale axis; reference-vs-value’s axis is identity and propagation. - When the choice is foreclosed — if a thing intrinsically can’t be copied (unique title) or can’t be shared (value type), there is no live fork and the duality degenerates.
Structure
Relationships
- deixis — the linguistics of the reference pole; reference-vs-value contains referencing as one horn of a choice.
- proxy — a structure on the reference horn; reference-vs-value is the fork upstream of choosing a proxy.
- context-asymmetry — reference couples holders into shared identity; value deliberately severs that coupling, drawing a context boundary.
- eager-vs-lazy — a sibling X-vs-Y duality: a binary fork with a cost-tradeoff and a gradient of intermediate positions; eager-vs-lazy forks on when, reference-vs-value on how to hold.
Examples
Robert W. Sebesta, "Concepts of Programming Languages" (Pearson, ch. 9 "Subprograms") — the standard treatment of parameter-passing modes. · computer-science
Robert W. Sebesta, "Concepts of Programming Languages" (Pearson, ch. 9 "Subprograms") — the standard treatment of parameter-passing modes. · computer-science
Black's Law Dictionary, entry "incorporation by reference"; U.S. Office of the Federal Register, "Document Drafting Handbook" (ch. 6, on incorporation by reference in federal regulations). · law
Black's Law Dictionary, entry "incorporation by reference"; U.S. Office of the Federal Register, "Document Drafting Handbook" (ch. 6, on incorporation by reference in federal regulations). · law
Janet Tavakoli, "Structured Finance and Collateralized Debt Obligations" (Wiley) on total return swaps and synthetic exposure; standard derivatives treatment of credit default swaps referencing an underlying obligation. · economics
Janet Tavakoli, "Structured Finance and Collateralized Debt Obligations" (Wiley) on total return swaps and synthetic exposure; standard derivatives treatment of credit default swaps referencing an underlying obligation. · economics