3 ms·
let (model', cmd') = state.update msg In order to write that you have to pin a reference to the state. But state is something that has to flow. Sure you can pi
by reverseblade2 6y ago
let (model', cmd') = state.update msg
In order to write that you have to pin a reference to the state. But state is something that has to flow.
Sure you can pin it to a ref, make it mutable and change the state but then nothing prevents you to change the state
arbitrarily e.g. from a command. I believe yes the answer is because we want to stay on the FP realm. FP imposes some restrictions to keep our sanity. So not having a reference
to the state and making it immutable is one of those restrictions.
- kingdomcome50 6y ago> In order to write that you have to pin a reference to the state Forgive my ignorance, but why is that the case? Isn't `state` being passed into the loop? Mutability is orthogonal to the question of where one defines a unit of behavior. Maybe an immutable object is not possible to achieve in F#, but one could certainly imagine the concept of an immutable type with methods. My question is more about the modes of organization: Large unions vs discrete modules and how they affect how one's ability to change a program over time. If you say that the architecture was chosen out of a purest sense of FP, then fair enough. I can understand why someone would go that route. Just had to know.