5 ms·
Doesn’t WASM provide a graceful and natural end to JavaScript’s hegemony? People can just use whatever language they want in the browser now.
by oofbey 4y ago
Doesn’t WASM provide a graceful and natural end to JavaScript’s hegemony? People can just use whatever language they want in the browser now.
- pjmlp 4y agoJavaScript is still the language that owns the platform, because WASM doesn't have any capabilities beyond compute, it up to the host to provide callbacks so that WASM code can call into the host, those callbacks are written in JavaScript.
- Mikeb85 4y agoNo because most languages don't just compile to WASM... You need to compile and distribute a runtime or, in the case of dynamic languages, full interpreter with the web page. JS is way less code to ship depending on how much interactivity you want...
- berkes 4y ago> You need to compile and distribute a runtime or, in the case of dynamic languages, But for all other languages there are easy compilers. Which is why WASM, apparently, is used with such languages mostly[1] I'd expect that these runtimes can be both distributed with browsers when they become really popular, and can be reduced in size. E.g. Python's runtime is relatively large and ships with a large stdlib. Most of which won't be needed in your code, so I'd expect it to be possible to compile a runtime that only includes what your code really needs, for example. [1] https://blog.scottlogic.com/2022/06/20/state-of-wasm-2022.html https://blog.scottlogic.com/2022/06/20/state-of-wasm-2022.ht...
- dmitriid 4y ago> People can just use whatever language they want in the browser now. Except, you know, WASM has zero access to browser APIs, and all interactions have to go through JavaScript. And on top of that you need to load your language's entire runtime to make it work.
- DeathArrow 4y ago>Except, you know, WASM has zero access to browser APIs True, and we have to wonder why is this still the case?
- pmontra 4y agoWASM does not interact with the DOM AFAIK. Of course one might (and probably somebody did) create a JavaScript programs interfacing a WASM web worker that sends user input in the JS -> WASM direction and executes DOM manipulation commands in the other one. All masked as a DOM library of the language that was compiled to WASM. Efficient? Probably no. Fast enough? Probably yes.
- 7373737373 4y agoThere is the WASI initiative https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webas...
- DeathArrow 4y ago>Of course one might (and probably somebody did) create a JavaScript programs interfacing a WASM web worker that sends user input in the JS Of course someone did. Check out Blazor. :) https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blazor https://dotnet.microsoft.com/en-us/apps/aspnet/web-apps/blaz...
- pmontra 4y agoThanks. In the early 90s there was "the law of Internet": if you can think about something somebody already made it and put it online. And it was a really tiny net compared to today.
- DeathArrow 4y ago>Doesn’t WASM provide a graceful and natural end to JavaScript’s hegemony? People can just use whatever language they want in the browser now. Not really since you can't manipulate the DOM from WASM.
- berkes 4y agoThat presumes that most of what JS does it "manipulating DOMs". At least in my frontend-code, this isn't the case. There is nearly always a much larger part that communicates with backends, sockets, HTTP, manages state, business logic and -validation etc. The "writing it to screen" is often a rather thin layer. At least in my projects.
- oofbey 4y agoYou probably wouldn't want to have to code in multiple languages even for a thin layer. Somebody could build that thin JS layer once for your language. Sounds like that's happening.