Sunday, January 12, 2020

AngularJS style web framework on Rust

I'm looking for a web framework which enable us to develop web application similar to AngularJS.
Although I don't like many aspect of AngularJS, which depends on too much runtime inspection/modification, it makes difficult to reason how it works. It is almost magical voodoo style programming.

But I like the clean separation of view/logic by HTML and model in JS.
While I looked at several web framework on Rust, all of them seems mixing presentation (HTML) in Rust.
Often HTML become very complicated, it is not good idea to include it in Rust programming code.
Of course, the action semantics must be written in Rust, but it should not include more than that.

Yew seems closest to my idea, but it seems relying on Html! macro.
action are mixed in the HTML description.

Rocket seems more server based approach. So some of server side application I may use it, but there will be simpler library for that purpose.( I need to investigate later)
Also the development seems almost stopped 1 year ago, a lot of samples are too old. This is bad sign.

--

So my plan is to investigate other framework which is closer to my ideal.
And I may develop missing part using wasm-bindgen, yew, servo.

For instance,
1) we will write HTML which include directives, and parse it and generate another normal HTML( no special directives) as well as corresponding event handling codes.
nasty part of code generation is it is difficult to synchronize modified code and generated code.
So ideally generated code and hand coded part should be co-existed.
2) in order to implement such code generator, we may use HTML parser html5ever of servo.
3)  then we will write a transformer of HTML node into normal HTML  node which also generated associated action logic Rust code.
4) It might be simpler to use wasm-bindgen for this part rather than mapping to yew element model.
Since it will duplicate node structure in browser and rust.

Anyway, I need to check these more.
Probably there will be this type of project, just I 'm not aware of.





No comments:

Post a Comment

Recursive Matrix and the parallel matrix multiplication using crossbeam and generic constant

This was planned project I posted before. Basically in order to evaluate Rust's claim for zero cost abstraction and the effectiveness o...