On Fri, May 15, 2009 at 3:49 AM, Robert Bradshaw
<[email protected]> wrote:
> On May 14, 2009, at 9:32 PM, Dag Sverre Seljebotn wrote:
>>
>> Wonderful, it looks very good. I'd love to get this in the release if
>> possible but I'll have to wait until you trust it (I'll update this
>> if I
>> get time for building Sage with it).
>
> Looks good to me too. The line
>
> type_name = self.qualified_name.split('.')[-1]
>
> in __getattr__ seems extraneous, as does the empty comment in the
> PyInt_from... code. With all this testing for basetype.is_int, it is
> almost testing to make a subclass just for int typedefs.
As I said, my patch is a very preliminar one... it is far from ready...
> Also, we are
> assuming that the only sizes that can occur are char, short, int,
> long, and long long. (It sounds inconceivable, but the C spec would
> allow 16-bit ints and 64-bit longs, or 64-bit ints as in ILP64.)
>
OK... I could fix this returning a PyLong instance.
>> There shouldn't be any behavioural changes *if* the external
>> typedef was
>> exact, right?
>
> I shouldn't think so.
>
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?
In short, the user has to inform Cython to not make assumptions about
the size of a particular ctypedef.
What do you think? Does this make sense? Any better syntax?
--
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev