|
|
|
|
|
by yummyfajitas
5731 days ago
|
|
Enter Lua's coroutines, which are really the only full and complete coroutines. I'm curious, could someone explain this statement? I was under the impression that Python had coroutines as well. Syntactically they are a bit uglier (yield statements everywhere), but functionally similar: http://www.python.org/dev/peps/pep-0342/ (Admittedly, I don't know a lot about coroutines, so I could be way off here.) In code: http://gist.github.com/630921 |
|
Lua's coroutines don't have those restrictions. I think Stackless Python doesn't have them either (though I haven't used it). Lua is also "stackless" in that sense. Also, Lua's coroutine.yield is a library function, not a keyword.
I'm not convinced coroutines/continuations are a good fit for managing web state, but they do make a lot of other control flow situations easier to manage - "who has the main loop" problems are a non-issue, since they can have an independent main loop.