On May 15, 2009, at 9:14 AM, Lisandro Dalcin wrote:

> 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...

Sure, just trying to make it more 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.

My point was that there are systems with none of char, short, int,  
long being 32 bits, but your extern type could have 32 bits. The if- 
then statement dispatching on type sizes wouldn't work.

>>> 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?

I'm -1 on both the syntax and the idea, comments in the next email.

- Robert

_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to