Stefan wrote: >What about this code: > > cdef int i > cdef float f > cdef object o > o = i = f = 1 > >I think the current way to split the assignments and handle them >separately isn't bad at all. This gives us the pretty code for my example.
I think (?) the rhs is either always an expression with one exact type (which can be further coerced, but still), or a constant literal. So I don't see a problem here, literals can be copied and expressions stored in temps. Or, it might work to simply analyse the temp as int, which coerces into the right thing on the individual assignments. The thing is, we're going to hit C at some point anyway, and the C code should be identical for any approach. Whatever way the current cascaded ass works, you just take it and try to break it up into smaller, more powerful concepts. It is all just about the numbers of concepts we are willing to carry across the whole way to code generation, and why... Currently I think all the different node types (or rather, the way they gravitate around Python constructs rather than CPython/C) makes it more difficult to increase how smart we can be in any significant way (with all kinds of optimizations, though especially refcounting perhaps). I'm starting to sound like a broken record though. I wrote a post a while ago called "a high level discussion" or something like that, I think anything on this subject should be taken up in that thread. I am not contesting that what works now works now, I am contesting whether it is the best model for future Cython development. (which also depends on the ambitions and goals I suppose). > ... I think doing the same thing in the case of cascading assignments is the > right fix for now. Agreed (though it doesn't look very important, if you have a char just type 0...). As I said I've paused it. (And if I'm the only one to think it would lead to better code design then it should perhaps not be done) Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
