6 ms·
You can compile software to WASM using emscripten. When you see a video game that runs in a web browser it was probably done via emscripten and wasm. When you s
by traverseda 4y ago
You can compile software to WASM using emscripten. When you see a video game that runs in a web browser it was probably done via emscripten and wasm. When you see old DOS games on archive.org those are done by compiling dosbox to the browser. Emscripten includes some shims for pretending you have a file system and a clock and all that stuff.
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.
- xeonmc 4y agocould you also compare the Quake Engine's virtual machines to WebAssembly? Or are they incomparable concepts?
- tempodox 4y agoA more lightweight tool than emscripten is the WASI SDK (https://github.com/WebAssembly/wasi-sdk/releases https://github.com/WebAssembly/wasi-sdk/releases). It doesn't generate JS or HTML but you can run its output on the command line with wasmtime or wasmer.
- mysterydip 4y agoThank you for the explanation! Time to read up on emscripten.
- EMM_386 4y ago> 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.
- EvanAnderson 4y agoI continue to be surprised that nobody has started marketing a browser (complete with accessibility features, internationalization, etc) that’s built in WASM. 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.
- deleted 4y ago[deleted]
- eminence32 4y ago> It could bypass HTML, CSS, and JS entirely and just run as if it were a desktop application. Not quite, because in order to display anything to the user, it still has to use HTML/CSS/JS
- krapp 4y ago>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.
- deleted 4y ago[deleted]
- traverseda 4y agoOr canvas elements.
- EMM_386 4y agoMy thought exactly, seeing how Flutter has an output for the web that renders to canvas, bypassing everything entirely. Then what do we have? A C# desktop application running under WASM inside a browser with a custom UI rendered to a <canvas> element? Is that where this is going?