Hacker News new | ask | show | jobs
by thaumasiotes 1573 days ago
> JavaScript is increasingly becoming a compilation target

JavaScript is the browser's machine code; having it as a compilation target makes at least as much sense as having an Intel chip as a compilation target.

2 comments

I hope you mean this in the manner that usually we _don't_ target Intel chips, and instead target the x86_64 ISA.

Sure, it's possible to target JS, but in the general-case it's wildly inefficient, and requires mental gymnastics compared to something like WASM. This is likely why people are bothering with WASM at all, rather than accepting JS as "the browser's machine code."

Wouldn't it make more sense to have WebAssembly as a compilation target?
Once it has access to the DOM, sure