Greg Ewing wrote:
Paul Moore wrote:
There's one further piece of the puzzle I'd like to see covered, though - with the language support as defined in the PEP, can the functionality be implemented library-style (like Lua) or does it need new syntax?
While it might not need new syntax, it does hinge fundamentally on changing the way the interpreter loop works, so I don't think a library implementation would be possible.
You are correct in saying that it would require a change to the interpreter loop, but that does mean it needs new syntax. I still think that a Coroutine class is the cleanest interface.
It seems to me that the greenlets approach may have to be the way forward. IMHO the yield-from approach is rather clunky. I think that flattening the interpreter is the most elegant solution, but the C calls presents in all operators and many functions is a killer.