The :hoplon: ClojureScript Web Framework - http://hoplon.io/
GusWill 2021-01-16T16:57:09.001300Z

hey guys, so, I've been learning reagent and hoplon and was wondering... whats the difference between between reagents ratom and javelin's cell?

GusWill 2021-01-16T16:57:26.001600Z

they both seem to do the same thing right?

GusWill 2021-01-16T17:00:47.003900Z

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?

phronmophobic 2021-01-16T18:16:05.005900Z

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.

GusWill 2021-01-18T15:28:20.021800Z

@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.


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)

kennytilton 2021-01-16T18:56:11.016100Z

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.

GusWill 2021-01-18T15:25:49.021600Z

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?

kennytilton 2021-01-18T15:30:05.022Z

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.

GusWill 2021-01-18T15:38:52.022500Z

I think I understand it now, thanks. But isn't this also possible with reagent's reactions?

phronmophobic 2021-01-16T18:56:17.016300Z

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