[Cython] separate 'initial typing' phase?

Stefan Behnel stefan_ml at behnel.de
Fri Dec 19 20:46:30 CET 2008


Robert Bradshaw wrote:
> - Type declared variables (this includes all "cdef T x" and builtins)
> - high-level transformations

That's where the major tree restructuring takes place, right? That's most
of what is currently in Optimize.py, plus the with-statement.


> - [type inference on untyped variables]
> - lower-level transformations

Would the constant folding go here as well? In the current state, it
doesn't take much care about types (or even type casts), although it
probably should do that for correctness.


> - type analysis and coercions

What would this step do with the already known or previously assigned
types? I guess that's node specific, right?


> - code generation
> 
> One issue is that in the current code base, there is a lot of code  
> that early on branches on whether or not the type is a python type or  
> not. I think much of this can be differed to right before code  
> generation.

I don't fear this that much. According to the main pipeline, we already
have a lot of the code running before type analysis. The refactoring would
be more about moving interesting stuff out of the type analysis phase and
into the earlier steps.

Stefan


More information about the Cython-dev mailing list