4 ms·
The annoying thing with function purity fanaticism is that it is out of touch with reality. State. Exists. State exists, so let’s deal with it with the tools
by crubier 7y ago
The annoying thing with function purity fanaticism is that it is out of touch with reality.
State. Exists.
State exists, so let’s deal with it with the tools that the language provides, instead of pretending it does not exist, just to realize later that it does and jamming as hoc answers to this initial oversight.
A UI component is fundamentally “something that generates values (view objects) asynchronously (over human-scale timeframes)”. That’s the definition of an async generator!
- josteink 7y ago> The annoying thing with function purity fanaticism is that it is out of touch with reality. State. Exists. It’s the opposite of all-state fanaticism, where nothing can be done or calculated without first 1. Creating classes, 2. Mutating their states, and often 3. Mutating global state. And then... magic! Both kinds of fanaticism are bad, and a middle-ground is probably best. Keep it simple. Use the best tool for the job, etc. That said, having worked with lots of code deeply inflected with global state, I’m more lenient to accept function-purity fanaticism over all-state fanaticism because at least then you only need to understand this one local oddity, not how it depends on the entirety of the rest of the codebase.
- crubier 7y agoI agree with that and I personally dislike OOP a lot and am much more on the FP side. But sometimes as you say a middle ground is best, especially when the thing is intrinsically stateful. But I have to say Dan Abramov does a good job of explaining why they need that purity here and it makes sense https://www.reddit.com/r/javascript/comments/g1zj87/crankjs_an_alternative_to_reactjs_with_built_in/fnkkgg3/?utm_source=share&utm_medium=ios_app&utm_name=iossmf https://www.reddit.com/r/javascript/comments/g1zj87/crankjs_...
- deleted 7y ago[deleted]
- exdsq 7y agoI think the state monad in F# makes a lot of sense - I'm now on the functional side after (finally) understanding it.
- rienbdj 7y agoParent was arguing against putting state in functions when classes exist. They weren’t arguing against state full code.