3 ms·
At the risk of stumbling into something terrible, who accepts Javascript as bytecode?
by Grimm1 5y ago
At the risk of stumbling into something terrible, who accepts Javascript as bytecode?
- imbnwa 5y agoIIRC V8 generates bytecode from the AST and compiles that bytecode
- krapp 5y agoJavascript as bytecode (or Javascript as assembly) is a paradigm that comes from compile-to-js languages like Typescript and asm.js[0], considering such "compiled" javascript as equivalent to a universal bytecode. Here's an old HN thread about it [1,2] and if you look around you can find it being asserted[3] as often as criticised[4,5]. Ironically, many of the arguments against the use of JS as bytecode just got transplanted into arguments against WASM, but one common argument against WASM is "why do we need this when we can already compile to javascript?" [0]https://news.ycombinator.com/item?id=5227274 https://news.ycombinator.com/item?id=5227274 [1]https://www.hanselman.com/blog/javascript-is-web-assembly-language-and-thats-ok https://www.hanselman.com/blog/javascript-is-web-assembly-la... [2]https://news.ycombinator.com/item?id=5762183 https://news.ycombinator.com/item?id=5762183 [3]https://news.ycombinator.com/item?id=3708919 https://news.ycombinator.com/item?id=3708919 [4]https://blog.izs.me/2011/09/javascript-is-not-web-assembly/ https://blog.izs.me/2011/09/javascript-is-not-web-assembly/ [5]https://news.ycombinator.com/item?id=5469310 https://news.ycombinator.com/item?id=5469310
- Grimm1 5y agoOh but that's not really bytecode is it? I'd say that's language transpilation. Which is a different topic, a contentious one for sure, but I don't think I'd qualify compiling down to another language as a form of bytecode, perhaps I'm splitting hairs though. My understanding is with bytecode that would then be read during execution on a vm or some such like Java, or Python bytecode during execution. JS is still a high level language which V8 then turns into it's own type of bytecode before being able to execute it.
- krapp 5y agoYes, I would agree completely... but I've gotten into enough arguments about it on HN and been downvoted hard enough for disagreeing with the premise to know how seriously a lot of people take it.
- ridiculous_fish 5y agoThe Hermes JavaScript engine statically compiles JS to bytecode. https://github.com/facebook/hermes https://github.com/facebook/hermes