Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Gary Bernhardt wasn't all that wrong when he mentioned anything that can be written in JavaScript will be written in JavaScript. This post indeed reminded me of his talk https://www.destroyallsoftware.com/talks/the-birth-and-death...


The only thing he missed is that javascript as a compilation target makes less sense than a byte code format designed for such a thing, which is what WASM is. WASM is more similar to JVM bytecode than it is to Javascript. It seems we have a few implementations of WASM that for historical reasons share a code base with a javascript interpreter. But technically that interpreter is not really needed.

You can actually use WASM to run your own javascript interpreter and people are already doing that to not be dependent on the interpreter that comes with the browser or wasm runtime (outside the browser). If you are going to run node.js in a wasm runtime, that's what you might want to do. Likewise, if you want to offer a browser IDE for a node.js project, you might want to run node.js in a browser and this is probably what you'd be doing rather than passing through the javascript to the browser javascript interpreter, which lacks most of the node.js API. Just easier that way.

Likewise if you want to run some old internet explorer 10 javascript, packaging up on old version of that as wasm might allow you to do that. The hard part of course would be getting your hands on the source code. But MS might help us out here or somebody might implement something compatible. Very much like is being done with flash.


Bypassing the idea that this thing is not run via JavaScript but WASM, he was definitely right :)


Use wasm2js to cross-compile WASM to pure JavaScript: https://www.google.co.nz/search?q=%22wasm2js%22 and there are other ways to not require native WASM!


I think it was by Jeff Atwood and hence is called Atwood's Law.


Aah, yes. My bad.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: