Change of heart about this project #69
Replies: 1 comment 1 reply
|
👋 I would love to see a framework like this. I was exploring a compiled reactive framework recently as a toy project, but I don't have the time to create anything more real right now so it is good to see someone else exploring these ideas!
You can use labeled blocks without a loop. I ended up making the type definition mark reactivity because the type was needed to create a struct.
You can have a WASM framework that runs faster than Svelte even when going through the WASM<->JS boundary. There are a few examples: Dioxus (the main framework I work on), and Leptos. It depends much more on the implementation of the framework than the choice of rust. You can also get faster than wasm-bindgen if you do run into that boundary. sledgehammer-bindgen is a project I created to reduce the (already small) overhead of talking to javascript from rust. Here are some things I ran into while implementing qk that I hope may be useful for you:
One more complete framework with a semi-svelte architecture is Kobold. One large difference is it uses macros instead of embedding rust in html. |
Uh oh!
There was an error while loading. Please reload this page.
I want to go about this in a different way. I want to completely move away from javascript and transform this into a frontend framework. The idea for the syntax would be something like this:
The idea is, to reformat the
<script>tag into valid rust. For example the reactive declaration$: bar = foo * 2;would be transformed probably into a closure likelet bar = |foo: i32| {foo * 2};so it can be recalculated when needed.All the code between the
<script>would be valid rust code except for the reactive declarations. I'm not entirely sure about that, possibly a different syntax for them. Rust has labels, but they're forforandlooplike'label: loop {}.The entire
<script>would then be compiled to web assembly and ran when needed (with javascript as glue because we can't get rid of that yet 😅). The DOM interactions would go through javascript and it would make the framework slower than Svelte (but when was the last time you had to render 1000 recursive divs 😄).I'm just throwing around ideas for now but I'm not sure if there's a rust frontend framework that does this. Mostly they all use macros to generate the HTML. I'm open to suggestions and what your thoughts are about this decision!
All reactions