2010/12/14 Stefan Behnel <stefan...@behnel.de>:
> Vitja Makarov, 14.12.2010 14:45:
>> 2010/12/14 Stefan Behnel:
>>> 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.
>
> Hmm, right, that's a missing feature that could become a problem.
>
> Second try. Create a new subtype of DefNode that nails the signature to
> METH_O and additionally implements all the generator specific stuff,
> potentially through sensible hooks in DefNode's code generation.
>

What is the best place to create node for generator body?
In analyse_...?

>
>> 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 having trouble parsing the last part of this sentence, but it seems we
> are agreeing that a subtype would be a good idea.
>

oops



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

Reply via email to