hey guys, so, I've been learning reagent and hoplon and was wondering... whats the difference between between reagents ratom and javelin's cell?
they both seem to do the same thing right?
what I'm trying to ask is, reagent and hoplon look very similar in terms of programming paradigm... You set some state in a ratom/cell, write a view function that emits html, this view automatically reacts when said state changes... so, why choose hoplon over reagent?
How does reagent handle a cell that depends on another cell. In hoplon, I believe you can have cells that depend on other cells that depend on other cells and they will be kept in sync.
@euccastro How would you compare ratoms with javelin cells? On the surface they seem to be different apis that serve the same purpose, right?
yes iirc ratoms require being more explicit with deriving new ratoms from dependencies. Javelin is more magic. Reagent tends to require explicit deref'ing to react to something while hoplon is more implicit (a cell passed as an element attribute will imply that that attribute will change when the cell changes, while reagnet, I believe, will have you wrap element in a function and call deref on the ratom.
https://github.com/reagent-project/reagent/blob/master/doc/ManagingState.md vs https://github.com/hoplon/javelin
Hoplon is tied to cells but i believe it could be modified pretty easily to use anything that's watchable/derefable so you could hack it to use ratoms if you really wanted to, I believe all that's stopping this from hoplon core is a couple calls to cell?
(this is probably a bad idea though)
There are a number of key differences. Javelin does not "see" dependencies reached via function calls. Also, in the form (if A B C) where A, B, and C are Cells, in Javelin dependencies are established on all three, tho any one result can really only depend on two, A and one other. Last I looked, I should add.
Thanks for your thoughts but I'm new to Hoplon so I'm not sure I follow. What do you mean by Javelin does not see? And what is the advantage of this model?
The formula for A may call a function F. F reads Cell B. No dependency is established between A and B. This comes up when we buy into reactive programming seriously, and reactive programming is a slippery slope: once we have cell A depending on B, B is likely to depend on sth else.
I think I understand it now, thanks. But isn't this also possible with reagent's reactions?
I think with reagent, reactions to updates are really just about rerendering (usually). I think hoplon is a little more general, and reactions can trigger other types of events.
True, yeah I believe ratom modications are batched to each animation frame by default