by mysterydip · 4y ago · 0 comments
There are also GC'd languages ported to WASM, things like Pyodide, but they're pretty big and have some rough edges as they're not normally allowed to do things like make network calls.
WASM is just a virtual machine, sort of like the JVM, but that runs in the browser. It might help to think of WASM (Web-ASseMbly) as a new CPU architecture. It's a minimal CPU instruction set (a virtual instruction set) that can be relatively easily jitted or transpiled into machine code.
WASM by itself doesn't do anything, the specs for what kind of interfaces exist between the WASM sandbox and the host app are still sort of in the air. It's soft of like saying "what can I do with a RISC-V CPU". The answer is "not much until we make more infrastructure that supports it.
Right now you can port large C code bases over to run in a browser with emscripten so that's nice. Maybe you'll write a web component using WASM at some point.
But doesn't this have the potential for a massive, paradigm shift in how we look at the "web"?
Take just one example, a GC language like C# or Java being able to run under WASM (inside a web browser?).
It could bypass HTML, CSS, and JS entirely and just run as if it were a desktop application.
Doesn't this lead us down the rabbit hole back to Java applets, Flash plugins and other similar plugins, albeit more secure/sandboxed?
If every website is free to render a button using any programming language it wants, there is no longer any standardization, accessibility features, a layout engine, etc.
What is the point of a "web browser" at all, if all it does is host a WASM-based application?
I think that's the part where my brain starts to give up.
>What is the point of a "web browser" at all, if all it does is host a WASM-based application?
It's to get around various walled gardens apparently.
I can imagine any number of media companies who would love to continue using their current web-dev pipeline but, by walling access to their servers off to this “trusted” WASM browser, could be reasonably assured that users aren’t using ad blockers, archive bots, etc. It’s the next logical extension of those ridiculous scripts that you used to see, popping up a “Access denied” message on a right-click because the website owner wanted to limit “view source”. The kind of numbskull who would do that would love a WASM-based browser.
Not quite, because in order to display anything to the user, it still has to use HTML/CSS/JS
Webassembly was designed to be usable outside of the browser, and multiple native runtimes already exist for it. It doesn't require the web stack, that just happens to be the most convenient way to use it at the moment.
Sorry for long whining, Webassembly should have materials for 1) a complete guide on how to write it by hand 2) have a toy language as a source to demonstrate how to map its ast to wasm instruction, it should cover at least 60-70% of wasm essential features.
Stop pointing to c++/rust/and tool chains. It's doesn't help understanding Webassembly itself.