11 ms·
It's not just an optimization. Functional style is often less clear and more confusing than using mutable state. For example, I move my browser window. My brow
by millstone 13y ago
It's not just an optimization. Functional style is often less clear and more confusing than using mutable state.
For example, I move my browser window. My browser models this as a Window object whose Position property is mutated to a new value. This is clear and easily understandable, in part because it matches the user's experience of moving a window.
A functional approach might be to construct a new window at the new position that shares some structure with the old window. This seems totally weird, and furthermore, it's hard to think of any benefit to keeping the stale, no-longer-onscreen window around, while it's easy to think of problems that might cause. We can pile more machinery on top (FRP, lenses, etc) but we only make the functional solution more complex.
(On that note, GUIs have got to be close to a worst case for functional programming.)
- Peaker 13y ago> it's hard to think of any benefit to keeping the stale, no-longer-onscreen window around, Undo? No aliasing issues? Transactionality of the set of changes being done?