Re:Poor man's signals – tiny vanilla JavaScript signals impl...
by jbhoot on Wednesday September 04, 2024 @08:07AM
(#41444697)
`okcontract/cells` seems to be missing one of the two FRP primitives though: streams (of events).
One of the best FRP environment for JavaScript is/was FlapJax: https://en.m.wikipedia.org/wiki/Flapjax, which incorporates both the primitives and their operations.
Re:Poor man's signals – tiny vanilla JavaScript signals impl...
by jitl on Wednesday September 04, 2024 @07:58AM
(#41444635)
It’s definitely not functional reactive programming, which needs to expose events and the history of events as first-order primitives, and usually a library of operations over the history of events.
If you simplify out the event stream primitive from FRP, what you are left with is not FRP.
Re:Poor man's signals – tiny vanilla JavaScript signals impl...
by hbbio on Wednesday September 04, 2024 @10:01AM
(#41445961)
Yes, as stated in the doc: "cells is a simplified Functional & Reactive (but not strictly FRP) library".
There were enough true FRP libraries around not to implement another one. We think cells is a sweet spot where we get most of the benefits of functional programming and reactive programming while simplifying the concepts from the original paper from Elliott and Hudak.
Re:Poor man's signals – tiny vanilla JavaScript signals impl...
by halfmatthalfcat on Wednesday September 04, 2024 @07:29AM
(#41444398)
Rxjs, most.js and a handful of others been around for a long time.
Re:Poor man's signals – tiny vanilla JavaScript signals impl...
by nine_k on Wednesday September 04, 2024 @06:12AM
(#41443888)
React is also FRP, only without impure ad-hoc DOM updates :)
But this pales in comparison to the world's most successful FRP application, the spreadsheet.
Re:Poor man's signals – tiny vanilla JavaScript signals impl...
by bubblesnort on Wednesday September 04, 2024 @06:54AM
(#41444150)
Bacon.js already did FRP about 10 years ago.
Our own take on this is https://github.com/okcontract/cells where we try to stick as close as possible to the spreadsheet analogy. We're using it to build a very complex web app and it's doing marvels.