ALL-STAT1001 · state_ownership
Judge whether mutable state has one clear owner.
This is a contextual rule for all languages. Read its implementation.
Definition
Section titled “Definition”Trace creation, mutation, aliases, exposure, synchronization, persistence, and lifecycle.
State several holders reach is still owned when one explicit governing contract decides
every write, whether that contract is a lock, a single writer, or a supplied protocol.
shared names state several holders mutate with no such contract to point at, and leaked
names internal state handed out for any caller to edit.
Evidence
Section titled “Evidence”Findings cite state declarations, aliases, writers, readers, transitions, and synchronization.
Exceptions
Section titled “Exceptions”Deliberate shared caches and framework state may be valid with bounded mutation and ownership.
Examples
Section titled “Examples”Returning an internal mutable list that callers edit is leaked. An immutable snapshot updated
through one repository is owned.
References
Section titled “References”- Cites “Fluent Python”, Object References, Mutability, and Recycling
- Cites “Refactoring”, Global Data and Mutable Data
- Cites “Programming Clojure”, immutable values and managed state