On Jul 7, 2009, at 11:24 AM, Lisandro Dalcin wrote:

> On Tue, Jul 7, 2009 at 2:30 PM, Dag Sverre
> Seljebotn<[email protected]> wrote:
>> Lisandro Dalcin wrote:
>>> On Tue, Jul 7, 2009 at 10:47 AM, Dag Sverre
>>> Seljebotn<[email protected]> wrote:
>>>> Or that #333-like behaviour will *only* be done if you use a  
>>>> "?"? If so,
>>>> for what gain? -- some fewer lines of C code? Why does it hurt to
>>>> "second-guess the user", as you put it in the OP?
>>>>
>>>
>>> Because of your fist question and my previous comment. Second- 
>>> guessing
>>> will be a bad thing...
>>
>> I disagree, I think second-guessing is wonderful. (That is, if you  
>> want
>> me to understand this, you must explain more -- of course, it is  
>> not a
>> necessity that I understand this.)
>>
>> If the only effect is to save a few lines of C and a few cycles of  
>> CPU
>> time for gcc, then I don't think it is worth it to complicate the  
>> language.
>>
>
> It is not about saving lines of CPU cycles... It's about providing a
> way for users to say: Hey! This extern ctypedef is EXACTLY what I
> declared Why is Cython trying to be smart and second-guess me, I'm
> adult enough ...
> Moreover, what I'm proposing is 100 % backwards, and the change to the
> languaje is rather minimal...

The main point of using external typedefs is that one often doesn't  
know the exact size of the type, e.g. it's determined at c-compile  
and/or configure time. (Otherwise, one could just use int, long, or  
whatever it actually *is* and the C compiler should never complain  
after unwinding all the definitions...) I am -1 on requiring a ? when  
the type is not explicitly known.

If one needs the sized to match exactly, one can "assert sizeof 
(my_int_type) == sizeof(long)."

The only difference I see with the ? notation is that it would be  
explicitly unranked (whereas the standard typedef receives its  
ranking from its definition). I guess in that case certain operations  
(like arithmetic with other types) would be disallowed? I just don't  
see this as a common enough use case to need new syntax (though I'd  
be curious to hear if it does fit the bill for what someone's trying  
to do).

> I agree on this particular point... member descriptors is something
> that is not worth changing. Or perhaps it would make sense to change
> the whole thing? We could use the current size-agnostic handling of
> ctypedef's for ALL integral types, even the builtin ones... That would
> certainly make the Cython codebase simpler, right?

ints, longs, etc. are so common that it's probably not worth the C  
code bloat.

- Robert


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

Reply via email to