I recently finished the basic Elm tutorial that Tenor introduced me to. The last assignment was on ports. This to me seemed very strange. What is an elm port? Why do we need it? It reminded me of this this Rust WASM feature request:
This could allow wasm to talk to js via CSP style message passing, different wasm instances to talk to each other without sharing memory, the wasm instances might even be in different threads by using web workers.
It is a pub/sub pattern, where JS subscribes to a port that is populated in Elm, and then sends messages on a port that is then handled in elm.
I did not expect Elm to work this way, but its not that strange. Maybe I can use some concepts and apply them to RUST WASM.
A few weeks ago I stumbled upon wasm when I was
- Looking for Rust projects to contribute to
I found it very magical writing something in rust and then publishing it as a node package and calling functions in another js function.
There are two resources I looked at for web assembly. The web assembly book https://rustwasm.github.io/book and https://rustwasm.github.io/book/game-of-life/implementing.html. I recommend the second one because it has a really interesting example of canvas integration with WASM. There is also a podcast on this week in rust about WASM. AND just because WASM was written for the web, and has ‘web’ in the name does not mean it could not be used for other things. It could be like a better type of virtual machine (think JVM) or something. Some other good links are the awesome rust and wasm page and wasm-bindgen examples. I also heard about an open frameworks-ish library in WASM from Max D.
It also made me think about the way JS communicates to Non JS. So JS and WASM, or JS and elm (ports). I am not sure why this is interesting, but there is something about this sort of interop that I find worth thinking about it.
I still have some more work to do on my personal Rust WASM project, and am going to work with Marko on a Rust WASM version of his breakout speed analysis comparison. I was going to put a link to the heroku deploy – but because of the rust module this is not trivial. I think I need to write a heroku build pack or publish the package to npm. But here is a screen cap – its in the browser !
This is unrelated to WASM, but J has a great blog post about editing our git history. This is super helpful since I sometimes get lazy on personal projects and commit with unhelpful messages. My main git trick is bfg, when I want to remove something that I should not have committed…. It happens.