Hi, I just noticed that Vitja's closure refactoring brought us closer to supporting generator expressions (before supporting generators and coroutines). Here's what's missing:
1) transform a GeneratorExpressionNode into a DefNode or a subclass (obviously excluding inlined generator expressions) 2) generate the resume code at the start of the function body 3) store temps in closures. For simplicity, this can be done with a tuple (which supports NULL values to a certain extent). That way, we do not need to declare each temp separately as a closure field. The remaining tricky bit is then to figure out the maximum number of temps that are alive at a YieldExprNode (ok, that's actually easy) and to pass that number on to the closure class that needs to allocate a sufficiently large tuple. That doesn't sound too hard. The generators CEP has the details for each step. http://wiki.cython.org/enhancements/generators Going for generator expressions before implementing generators has the advantage that it gives us most of the infrastructure without requiring the additional steps of passing initial arguments into the generator and implementing the complete coroutine protocol (the yield nodes cannot return values, for example). Anyone with a little time to spare? Stefan _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev