Can't wait for DOM interop and get away from JS on frontend. Seriously JS should not be the lingua franca of the web :)
WebAssembly support now shipping in all major browsers
71–80 of 346 posts
Re: WebAssembly support now shipping in all major browsers
#72Can anybody ELI5? The documentation is pretty fluffy. Does WebAssembly actually open up any new API hooks? I get that its a clever way of transpiling existing programs to JavasScript, but surely we could do that already? Whats new avenues of development is WebAssembly expected to open up? Is the whole point just to enable an easy way to compile games made on other platforms (Unity) to the web?
Re: WebAssembly support now shipping in all major browsers
#73Earlier quoted context omitted.
I think it's darkly humorous that I have to install browser plugins to stop sites from mining monero in my browser. It's like websites are those creepy spider things in the Matrix, except instead of sticking humans in pods to harvest their biochemical energy, they're just running up our home electricity bills by maxing our CPUs.
What plugins do you recommend for this?
It's now a default install on every browser of every computer I touch. Even on Firefox on Android, which works really well btw.
Re: WebAssembly support now shipping in all major browsers
#74For those in the know, what doors is web assembly expected to open? Better cross platform platforms via a browser wrap? Will new types of browser applications be possible that aren't now in JS only world? What are they?
Re: WebAssembly support now shipping in all major browsers
#75Can anybody ELI5? The documentation is pretty fluffy. Does WebAssembly actually open up any new API hooks? I get that its a clever way of transpiling existing programs to JavasScript, but surely we could do that already? Whats new avenues of development is WebAssembly expected to open up? Is the whole point just to enable an easy way to compile games made on other platforms (Unity) to the web?
WASM is an intermediate representation which is output by your compiler (of your favorite language) and consumed by the browser's compiler to emit native code.
WASM is a bit similar to LLVM IR, but it's architecture independent.
Compare this to, say, LLVM and Clang. Clang (the C compiler front end) will read C code and emit LLVM IR. LLVM (the compiler backend) will read LLVM IR and emit assembly code for your CPU. With WASM, the developer will run the "front end" and distribute the WASM code over HTTP and the web browser will run the backend and turn WASM into native assembly code.
> I get that its a clever way of transpiling existing programs to JavasScript, but surely we could do that already?
No, WASM code is not JavaScript at any point. ASM.js is a predecessor to WASM that was a compiler-friendly variant of JavaScript that can be compiled to native code.
Re: WebAssembly support now shipping in all major browsers
#76A good occasion to watch Gary Bernhardt's talk "The Birth & Death of JavaScript" [0] again, where he talks about the precursor of WebAssembly: asm.js and the future implication it "could" have in the future in a really humorous way. A few years old but still relevant. You want Gimp for Windows running in Firefox for Linux running in Chrome for Mac? Yeah sure. [0] https://www.destroyallsoftware.com/talks/the-birth-and…
Netscape navigator on DOS in Firefox via WebAssembly.
Re: WebAssembly support now shipping in all major browsers
#77Can anybody ELI5? The documentation is pretty fluffy. Does WebAssembly actually open up any new API hooks? I get that its a clever way of transpiling existing programs to JavasScript, but surely we could do that already? Whats new avenues of development is WebAssembly expected to open up? Is the whole point just to enable an easy way to compile games made on other platforms (Unity) to the web?
This means that WebAssembly is actually broader than just the web; for example the Etherium folks have been discussing using wasm as their language to script their blockchain.
It doesn't currently open up any real new API hooks; it's mostly about being an efficient language for computation. You get near-native performance in the browser. In the future, it may or may not grow more hooks directly into the web platform, rather than needing to call into JS to do so.
Re: WebAssembly support now shipping in all major browsers
#78Earlier quoted context omitted.
That's true as far as it goes - but wasm lacks general "goto" instructions (across procedures), and loops only work for self-tail-calls. There's an expressiveness gap between languages with and without proper tail calls. (Unless you're willing to accept the unsafe-for-space solution.)
I think it would still be possible to implement Scheme with the current specification, which is on my snowy weekends to do list for the upcoming Winter. How far I would get before losing interest or facing those issues, I don't know.
Re: WebAssembly support now shipping in all major browsers
#79Can anybody ELI5? The documentation is pretty fluffy. Does WebAssembly actually open up any new API hooks? I get that its a clever way of transpiling existing programs to JavasScript, but surely we could do that already? Whats new avenues of development is WebAssembly expected to open up? Is the whole point just to enable an easy way to compile games made on other platforms (Unity) to the web?
I can address at least the first misconception here - this isn’t transpilation to JS. This is native code that has browser APIs exposed to it, so in theory there should be massive performance wins.
The really exciting thing people should be talking about is not WebAssembly but the general availability of SharedArrayBuffer[0] which finally makes it possible to run "foreign" multi-threaded code efficiently.
[0]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
Re: WebAssembly support now shipping in all major browsers
#80How do I compile/target stuff for WebAssembly and integrate it with "usual web" (I need to use some advanced math & WebGL real-time that is too slow in JS)? Is there any good tutorial? Thanks!
For C and C++, you have emscripten. For Rust, we have an emscripten-based toolchain that works today, but have a PR open for using LLVM's built-in wasm backend.
For emscripten: https://kripken.github.io/emscripten-site/docs/#
For Rust: https://hackernoon.com/compiling-rust-to-webassembly-guide-4... (slightly older but still should work afaik) And the new backend https://github.com/rust-lang/rust/pull/45905