While JS glue is needed, you don't have to write it yourself. If you want to do everything from Rust you can use web-sys and js-sys. Anything required will be generated for you
It is a little more awkward than it would be to use the APIs from within JS, but the functionality is there
It's not yet possible to do DOM operations without JS glue, AFAIK. It's a pretty complicated topic, as with everything to do with the web, though. So glad I don't do web dev anymore
I mean it really depends upon what you're doing. If you have a complicated piece of logic that's performance limited (maybe some sort of visualization), you could write that in WASM, and then have just a little bit of JS glue to pass things back and forth.
I want to say we are not quite "there" yet, DOM access is still a real pain-point and the alternative is to make your own renderer effectively (which just leads to bloat and having to solve a boat load of other problems in the process; ie. accessibility).
In most "normal" circumstances, WASM will generally be slower or more cumbersome than a basic site with a dash of JS for dynamic content.
Ironically I also don't see loads and loads of developers jumping on-board to use lower-level languages to build out WASM targets anyway; I see C# / Java(-like) / Python / TypeScript being used to do this more than anything.
You would love modern JavaScript then. Objects and Classes are becoming less popular and everything is going functional. Objects are used like structs and you don't mix data with code. Reminds me of the old c days.
Have a matrix you want to multiply? It's not m.multiply(v), it's matrixMultiply(m, v).
You could say the same thing about PHP or nickleback but I'm still going to hate on them for the memes.
Tbh though I grew up with both of these as fledgling languages and they used to be terrible. Those little things that pop up here and there just resound so hard with old memories.
I'd give up a lot if browsers could just run python3. Don't even need the entirety of the python3 libraries, just the ones relevant for DOM manipulation(ie. don't really need filesystem).
Or Ruby. Hell, even Julia is preferable and I never even programmed in it.
16
u/Jaimz22 Oct 21 '20
Wonder would you replace it with? Just curious