2010/12/14 Stefan Behnel <stefan...@behnel.de>:
> Stefan Behnel, 13.12.2010 06:37:
>> Vitja Makarov, 12.12.2010 20:23:
>>> What do you think about GeneratorWrapperNode?
>>
>> It seems ok. I'll give it a deeper look ASAP.
>
> Actually, after looking through it, I think it's an ugly hack. It tries to
> hide the fact that the DefNode does the wrong thing for the two faces of
> generators, and that the current implementation does not build a separate
> node at transform time that does the right thing instead. IMHO, two nodes
> are needed. A CFuncDefNode (or a subtype) that writes out the generator C
> function with the right signature and the original body, and the original
> DefNode (with the original signature) that has its body replaced by the
> necessary generator setup code. That's basically why the original CEP
> proposed to split the DefNode implementation *before* going for generators.
> Would have made this easier.
>

Are you sure that CFuncDefNode for generator body is a good idea?

Nested function and classes, lambda, generators are not supported
inside CFuncDefNode.

Btw. It would be nice to make DefNode base for GeneratorNode, all the
generator creation stuff could be moved into generate_function_body()
and make generator body childern of GeneratorNode.

I'm thinking of genexprs they are very similar to lambdas and could be
implemented reusing lambda stuff.

-- 
vitja.
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to