by mpweiher · 9y ago · 0 comments
That's kind of the definition of encapsulation.
> difficult to reason about
This is repeated as a mantra without any backup. Most people find state trivial to "reason" about. What becomes more difficult are certain types of proofs that nobody actually does.
> [FP] makes it easier to manage and control state
No, not "easier". In fact, incredibly more difficult. Just try updating a nested member. What it does is make it easier to isolate state updates, because it makes it so arduous.
State encapsulation, at least in FP, means that the state is not visible externally. For example a pure function that uses mutable state in its implementation. Such state does not contribute to the sytem global state.
> This is repeated as a mantra without any backup.
The more global mutable state your application has, the harder it is to reason about. That should be fairly obvious I think.