5 ms·
Some features typical of VM languages, like "goto" makes it more appropriate as a compilation target, because lots of higher-level control structures kan be com
by olavk 14y ago
Some 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.