Dag Sverre Seljebotn wrote:

> a = g(f(), a)
> 
> would then have this flow:
> 
> - The NameNode is a lhs, so generate_assignment_code is changed so that 
> its target cname is returned to the SimpleAssignmentNode.

Be careful here -- you can't just stuff the result
straight into the lhs. You need to evaluate the rhs,
make sure you have a new reference to it, decref the
lhs, and then do the assignment, in that order. So
you need a temp for the rhs anyway, if it's anything
other than a bare name.

I can't really see what you're expecting to gain from
this change, over and above what you'll get simply by
moving temp allocation to code generation time. At best
you'll move some of the generic code from one place to
another; at worst you'll end up duplicating it in many
parent nodes.

The only possible benefit I can think of is that it
might eliminate the need for CloneNodes. But I'm not
so sure about that -- you'll still need some way of
differentiating between the "owner" of a node and
nodes that simply use its value, so you don't end up
trying to generate evaluation code for it more than
once.

Seems to me that things will already be a lot simpler
and clearer once all temp handling is moved to code
generation time. Are you sure that won't be enough?

-- 
Greg
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to