Hacker News new | ask | show | jobs
by nemo846 2791 days ago
But why use JavaScript engine as the “base”? Why not a more “general” VM?

WASM just skips the JS to JIT compiled bytecode - correct me if I’m wrong. Creating a standardized bytecode for distribution that other languages can compile to.

No reason to continue to shackle the web to JavaScript.

2 comments

Here is a pretty good explanations of the WASM roadmap and why they want certain things.

https://hacks.mozilla.org/2018/10/webassemblys-post-mvp-futu...

I'm no expert, but I think one issue is the lack of a GC in WASM. So each language have to roll their own custom GC on top of it.

Another reason is JS already has many high level features. Which might make it easier to implement similar ones in your language if you target JS directly.

The last reason I can think of is interop with existing JS code and the DOM.

These things are on the roadmap atm.

Better WASM/JS interop is on the way, though atleast on Firefox nightly you can get this for fairly low cost for some functions.

GC is also on the todo list and IIRC might get an early preview in Firefox Nightly.

Once the GC is done, DOM integration will happen, people are eager for that and that would eliminate a lot of the necessary JS glue code.

A GC for wasm is planned, as is DOM/browser API interop.