Even after wasm becomes first-class in browsers, on the same level of javascript, why write UI code in systems programming language without GC? Considering that actual UI is DOM elements, only “glue code” is written in Rust.
Anyway, exploring this possibility is cool.
BTW, Rust might be useful in actual desktop GUIs because of fast startup (unlike JVM and languages that compile sources on program start), better interop with C and controllable memory consumption. React-like library might be cool on desktop too.
i’ve written some elm-inspired desktop gui code in ocaml+gtk; it’s a very pleasant paradigm to program in. you don’t really need a framework, the gui library provides an event loop for you.
it worked out pretty nicely, writing a web view as well helped a lot in factoring the gui code properly, and now i get to use the gtk frontend to prototype features for the web frontend (i expect the web frontend to be the one i actually “ship”, but writing a desktop app is a lot easier)
Even after wasm becomes first-class in browsers, on the same level of javascript, why write UI code in systems programming language without GC? Considering that actual UI is DOM elements, only “glue code” is written in Rust.
Anyway, exploring this possibility is cool.
BTW, Rust might be useful in actual desktop GUIs because of fast startup (unlike JVM and languages that compile sources on program start), better interop with C and controllable memory consumption. React-like library might be cool on desktop too.
i’ve written some elm-inspired desktop gui code in ocaml+gtk; it’s a very pleasant paradigm to program in. you don’t really need a framework, the gui library provides an event loop for you.
The ocaml+gtk code sounds interesting, do you have that online by chance?
model and controller
gtkgui view
web view
it worked out pretty nicely, writing a web view as well helped a lot in factoring the gui code properly, and now i get to use the gtk frontend to prototype features for the web frontend (i expect the web frontend to be the one i actually “ship”, but writing a desktop app is a lot easier)
thank you, reads nicely!
Note that this requires no emscripten, you can build and run the examples using the
wasm32-unknown-unknowntarget.How much JS would you have to write to use this? From what I understand wasm requires JS to do anything.
The TodoMVC example has no JS code in it (no .js files or invocations of the stdweb
js!macro), it’s all Rust.