We all know mutable state can be problematic. But the explanations tend to be abstractions like "reasoning" and "composability". What's a simple *convincing* example in single-threaded code? Having trouble making one that isn't obviously bogus. Is it only a problem at scale?
But that's the point, isn't it? FP is about making programming more like math. It's natural to pick examples from the math domain, where the contrast is most obvious. I guess I'm not sure whether you're against the reasoning or against the choice of example.
-
-
For a non-math example, I like UI programming. e.g. jQuery spaghetti where DOM is treated as mutable state separate from the data (also mutable state). Easy to have state mismatches. But React/FRP goes a long way towards solving those issues.
- Show replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
cognitive psychology. PhD