3 ms·
WebAssembly is quite a small change from asm.js - it's mainly a different transfer format and a parsing speedup. It's targeted towards non-GC languages like C/C
by fulafel 9y ago
WebAssembly is quite a small change from asm.js - it's mainly a different transfer format and a parsing speedup. It's targeted towards non-GC languages like C/C++ and Rust - for managed languages, Javascript is the only sane compile target.
- cookiecaper 9y agoScripts for GC languages wouldn't be compiled directly for WebAssembly -- their runtimes would. That's why I suggest browser vendors bless a few specific alternative runtimes and distribute them with the browser. For example, PyPy would be compiled for WebAssembly, and then Python could be executed directly as a client-side web language. Same with Dart and other languages that depend on a VM to do the heavy lifting.
- fulafel 9y agoI guess if wasm some day gets GC support and runtime code generation, there might be something to this idea - for a language like OCaml that is designed for AOT compilation.
- mraleph 9y ago> Scripts for GC languages wouldn't be compiled directly for WebAssembly -- their runtimes would It is not a walk in the park to compile runtime into WebAssembly (unless you are just compiling an interpreter). Performant runtimes usually include machine specific backends and/or hand written assembly code. You'll need to port that all to target WASM too.
- cookiecaper 9y agoYeah, though I haven't worked on that directly, I'm sure it's not trivial, but I think there is sufficient demand. Check out http://pypyjs.org http://pypyjs.org , which uses emscripten to compile to asm.js and then bolts on a custom JIT that emits asm.js, for one example of a project that is already trying something like this.