hoplon

The :hoplon: ClojureScript Web Framework - http://hoplon.io/
flyboarder 2018-12-20T04:09:10.022500Z

@bob592 yes since v7 the demos are probably a bit old - they should still work for the most part - if anyone runs into issues we can help sort them out

bobcalco 2018-12-20T22:21:48.027Z

@flyboarder Can you summarize for me the operational semantics of javalin/hoplon vs react? I gather it's doing FRP, just differently, but I don't really get the details yet. The idea of modeling state change as "cells" in a spreadsheet is interesting and not unfamiliar (I worked with someone from more of a CL background who created a similar library, but it did more server-side computation). However, I'm not sure how that works with DOM re-rendering in the CLJS context. I get both React and Elm's approach, which rely on computing diffs of DOM state relative to a virtual DOM. Can you help me understand it?

bocaj 2018-12-20T22:22:58.027600Z

https://youtu.be/UoZyyo2Bwr8

flyboarder 2018-12-20T22:25:31.028Z

^ great resource!

flyboarder 2018-12-20T22:30:57.029100Z

With hoplon we swap whats in the dom based on state, however there isnt really any computation done on the DOM, we just store the elements in cljs data collections and then when that changes we put the changes in the DOM

flyboarder 2018-12-21T19:09:50.002400Z

Yep you go it! No V-DOM and we do pay as you go templating so only the current screen elements are created, as you change screens templates are cached and created as you go

bocaj 2018-12-20T22:40:56.031100Z

I've not read the source yet...how does javelin interact with Hoplon/hlisp ? If a cell changes, a node changes?

flyboarder 2018-12-20T22:52:49.031400Z

with a very special protocol

flyboarder 2018-12-20T22:53:31.032200Z

all the magic is implemented right here:

flyboarder 2018-12-20T22:54:53.033300Z

a “managed element” is an element where we track changes using cells

flyboarder 2018-12-20T22:57:32.034400Z

then when cells change we fire the attribute functions above, attribute-providers implement the logic for each attribute

flyboarder 2018-12-20T22:59:52.034800Z

and here is the magic for how the attributes are implemented:

flyboarder 2018-12-20T23:01:16.035200Z

I guess this would be a decent summary “If a cell changes, a node changes”

bobcalco 2018-12-20T23:13:47.036200Z

OK the video was helpful - I like javelin. But how to understand castra? IOW, MOAR please. 🙂

bobcalco 2018-12-20T23:20:03.039100Z

Also, one thing I want is whole-document control - for example I want different links to css and js depending on certain context (e.g., logged-in?) so that I can render different design if necessary. It looks like hoplon supports that with toplevel html, head and body tags. IOW, I want to mount the whole document, not just some div as in react.

bocaj 2018-12-20T23:21:29.040300Z

Yup looks like you can do this.

bobcalco 2018-12-20T23:31:49.042800Z

Castra looks really interesting. I'm trying to wrap my head around the idea of component-izing both the back and front end as one unit (library). 🙂

bobcalco 2018-12-20T23:47:09.042900Z

IOW, there is no intermediary "V-DOM" representation of state to compute - data flow results in changing only what needs to be changed... no need to diff because there's no need to search the DOM to see what's "different"...?