Lisandro wrote: > And that's the BIG problem... If we are going to stop making > assumptions about sizes, we cannot use the rank stuff for binary > operations. Moreover, if a user is sure a ctypedef match a particular > type, we should use that information. And we have the bacward > compatibility issues... Then I'm thinking on this syntax: > > cdef extern: > ctypedef signed ? MySignedInt > ctypedef unsigned ? MyUnsignedInt > ctypedef float ? MyFloat > ctypedef complex ? MyComplex > > or perhaps > > cdef extern: > ctypedef signed MySignedInt? > ctypedef unsigned MyUnsignedInt? > ctypedef float MyFloat? > ctypedef complex MyComplex?
I tried proposing something similar (unknown size) some time ago and it was voted down; perhaps the climate has changed now. I support this anyway for more transparency about what Cython does (though none of those syntaxes), but I don't think it is really needed: This only affects situations where the type size is actually used for something. I can only think of constructing temporaries once this patch goes in. And how many situations can you think of which constructs temporaries of the type of the result of a binary operation? The only one I can think of is Python-style division (which was only recently added, and where it is probably possible to rely on the compiler optimizing out a common expression for external typedefs instead of using a temporary -- must benchmark first though). So this isn't a big problem now, IMO. It WILL become a problem with type inference, but that's a bigger discussion we can have later. Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
