3 ms·
Just transform it to continuation-passing style[1] and call/cc is no problem (neither are non-local exits). Granted your compiled code will be somewhat large an
by PeCaN 11y ago
Just transform it to continuation-passing style[1] and call/cc is no problem (neither are non-local exits). Granted your compiled code will be somewhat large and not much like 'regular' code in the language. That can be solved by doing selective CPS transform (IcedCoffeeScript[2] does this), but that gets slightly less straightforward.
Compiling continuations to a dynamic language is actually really easy.
--
1: https://en.wikipedia.org/wiki/Continuation-passing_style https://en.wikipedia.org/wiki/Continuation-passing_style
2: http://maxtaco.github.io/coffee-script/ http://maxtaco.github.io/coffee-script/
- truncate 11y agoI'm interested to know more about IcdeCoffeeScript approach. Any blogs/articles that you know of? Typically direct CPS conversion are straightforward, but the performance suffers a lot. I'm looking for languages that are using some hybrid approaches.
- wtbob 11y ago> Just transform it to continuation-passing style and call/cc is no problem (neither are non-local exits). Granted your compiled code will be somewhat large I'm well aware, but CPS code can be _insanely_ large (essentially a function declaration for every line of code in the original source). That's quite painful.