3 ms·
This is very nice in theory, but in practice you can only do it in assembly language, because no commonly used high level language supports the coroutine call p
by jcl 16y ago
This is very nice in theory, but in practice you can only do it in assembly language, because no commonly used high level language supports the coroutine call primitive.
This might have been true when the article was written, but things are slightly different today. JavaScript, Python, and C# have picked up generator primitives that can be abused to provide limited coroutine support. Lua, with actual coroutine support, is gaining in popularity. And it will be interesting to see what happens with PyPy, which has support for the Stackless Python coroutine primitive.
There are apparently lots of uncommonly used languages with coroutine support:
http://en.wikipedia.org/wiki/Coroutine#Programming_languages_supporting_coroutines http://en.wikipedia.org/wiki/Coroutine#Programming_languages...
- silentbicycle 16y agoYou can make coroutines in Scheme via continuations, and you can also make one-shot continuations out of coroutines. "Revisiting Coroutines" by de Moura and Ierusalimschy (http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.58.4017 http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.58.4...) is a pretty good paper about using coroutines, with Lua as the example language.