On Apr 19, 2010, at 11:18 PM, Stefan Behnel wrote:

> Hi,
>
> I ran into this more than once already, so I think this is worth
> discussing. In a couple of cases, an analyse_types() method finds  
> out that
> the current node isn't suitable for what is actually happening.  
> There are a
> couple of different hacks that deal with that, ranging from __class__
> replacement to a partial reconfiguration of the node together with a
> subsequent transform that replaces it.
>
> Could we change the semantics of analyse_types() to return the  
> current node
> instead, so that it is free to return a different node if it needs to?
> Since this isn't happening in a transform, this would mean that we  
> need to
> change a lot of code to get the old node reference replaced wherever
> analyse_types() is called, but these places shouldn't be too hard to  
> find
> at least.
>
> I know that this interferes with the idea of transforms, but at  
> least in
> some cases, it's easier to replace a node directly after finding out  
> that
> it needs to be replaced, than to do part of the analysis now and to  
> rely on
> a later transform to do the replacement and the correct setup of the  
> new
> node, especially when it may have an impact on some of the surrounding
> nodes (e.g. because the new node returns a completely different type).
>
> What do you think?

+1, that's a very good idea. It's a big change, but I don't think  
it'll introduce bugs as it'll be easy to find where things need to be  
fixed.

- Robert

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

Reply via email to