7900 shaares
161 private links
161 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.