Yeah Motion.cr (and Liveview, and Hotwire, etc.) are super interesting approaches for sure.
The thing I don’t love about that approach, however, is that it tucks a bit of magic behind the scenes and I believe that ultimately can be limiting. Motion, for example (not to pick on it - I think it’s really a cool idea!) still requires you install a JavaScript client (import { createClient } from '@awcrotwell/motion'; const client = createClient();
) in your frontend code and then handles the UI updates automagically via that client.
The reality is that there is DOM work being done by a framework, be it Motion’s JS client, React, Svelte, Vue, or whatever. And for the time being, that’s the way it needs to be. So my preference is that rather than to hide that work in the background, embrace it and empower the developer to really understand what’s going on.
Svelte, for example, makes no excuses: You have the power to directly manipulate DOM nodes and it’s very clear about what the framework does and doesn’t do. It’s also what I’d call “Turing complete-like” – which is to say not to the true scientific definition of Turing complete, but that there is basically no UI interaction that you cannot make with Svelte (or React, or Vue). It covers the full gamut.
I prefer the approach where the developer has full control (at a native level) of the various pieces of the environment. And for the time being, browsers run on Javascript, so we should do our dirty work in JS in the browser (via Svelte, in my happy place).
But! If WASM fulfills its aim, we will truly be able to compile from anything (ahem Crystal) to WASM and manipulate DOM nodes directly (or, perhaps, interact with Svelte’s API so we can keep concerns separated).
LMK if any of this makes sense :)