4 ms·
I agree with you in general about 'mostly functional' being a sweet spot, but I think there's also lots of room for pure functions and immutability in ui progra
by danenania 13y ago
I agree with you in general about 'mostly functional' being a sweet spot, but I think there's also lots of room for pure functions and immutability in ui programming without bending over backward too much.
For example, rather than creating a big oo hierarchy to model a ui, you can describe it declaratively as immutable data, then transform it with chains of pure and semi-pure functions whose only ultimate side effects are updating whatever bits of state absolutely must be held onto (ideally not much) and rendering the ui. I think that qualifies as 'mostly functional' even though it's not totally pure and doesn't use monads or other advanced constructs.
I haven't yet toyed with react.js, but I believe it takes an approach similar to this.
- yohanatan 13y agoReact.js does take that approach and you might be interested to use it via the Om wrapper for Clojure (w/ it's emphasis on immutable data structures).