Dag Sverre Seljebotn wrote:
> Is it impossible for constant folding to happen before type annotation?
> After all, the type should be hard-coded in the class for constants?
Not sure. At least, it needs scope and target type information in its
current way of working, as it does type coercions. It might be possible to
remove that completely, and to determine the widest target type of two
operands instead. Want to have fun giving it a try? :)
> Or at least, a seperate "type constants" phase first is much easier
> than a full refactor here.
Let's try first if the default type associated with a constant is enough
for plain constant folding.
BTW, I'm not sure how type casts should be handled. What about something
like this:
cdef int x = 3 + <long><char>(2**10)
? Whereas
cdef int x = 3 + <int>(2**10)
would simplify just fine...
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev