8471 shaares
203 private links
203 private links
How do we actually encapsulate state, and actually regain compositional reasoning, fully? The technique that actually works is confining state locally. Confining state to within an object (“encapsulation” as it’s usually meant) doesn’t get us there because the state is owned by the object and thus escapes, but fully-local to a function does successfully isolate that state.