4 ms·
Honest question - what can you do with bytecode that you can't do with javascript? Modern javascript is fast and ubiquitous and is clearly not going away anytim
by phpnode 14y ago
Honest question - what can you do with bytecode that you can't do with javascript? Modern javascript is fast and ubiquitous and is clearly not going away anytime soon. Isn't the human readable nature of javascript more suitable for debugging anyway?
- olavk 14y agoSome features typical of VM languages, like "goto" makes it more appropriate as a compilation target, because lots of higher-level control structures kan be compiled to gotos. Of course goto could also be added to the JavaScript language as is, but then we have a conflict since goto is nice in a low-level language, but discouraged in higher level languages. This conflict of interest in language design does not exist when the user language is seperate from the VM-language. I agree with your point though.
- pcwalton 14y agoThe Relooper is good enough that the lack of goto isn't an issue in a practical sense these days.
- politician 14y agoThe Emscripten Relooper algorithm "takes basic blocks of code - chunks of simple code, at the end of which are branches to other blocks of code - and generates high-level structure from that using loops and ifs." http://mozakai.blogspot.com/2012/05/reloop-all-blocks.html http://mozakai.blogspot.com/2012/05/reloop-all-blocks.html
- pcwalton 14y agoThat's my point. The Relooper does a good job with vast majority of code that you might conceivably want to compile to JS, making the lack of goto not a problem in a practical sense for these compilers.
- politician 14y agoHah, sorry, I didn't know what Relooper did, so I posted a comment describing where to find out about it for other people.