3 ms·
I've been really enjoying ToffeeScript, which provides implicit continuations. It was trivial to implement coroutines on top of it: https://gist.github.com/luci
by atrilumen 13y ago
I've been really enjoying ToffeeScript, which provides implicit continuations. It was trivial to implement coroutines on top of it: https://gist.github.com/luciangames/7776345 https://gist.github.com/luciangames/7776345.
It works very well if you bear in mind what's happening to the call stack. In my case, every call to pause! or wait! is scheduling a continuation to be called later by the game loop. If I'm not mistaken, the overhead of each continuation is just that of a closure.
It's very comfortable, coming from a background in Stackless Python, Lua, and Unity.
I wish more people would take a look at ToffeeScript.