Robert Bradshaw wrote:
> On Mon, 4 Aug 2008, Lisandro Dalcin wrote:
> 
>> Current cython-devel trunk broke my code, for example, try to run
>> cython on this snippet:
>>
>> cdef extern from *:
>>
>>    cdef void foo(int[])
>>
>>    ctypedef int MyInt
>>    cdef void foo(MyInt[])
>>
>>    struct MyStruct:
>>        pass
>>    cdef void bar(MyStruct[])
>>
>>    ctypedef MyStruct* MyStructP
>>    cdef void baz(MyStructP[])
>>
>>
>> I get error messages like (just the first shown):
>>
>> Error converting Pyrex file to C:
>> ------------------------------------------------------------
>> ...
>> cdef extern from *:
>>
>>    cdef void foo(int[])
>>
>>    ctypedef int MyInt
>>    cdef void foo(MyInt[])
>>                      ^
>> ------------------------------------------------------------
>>
>> /u/dalcinl/Devel/Cython/sandbox/arrdecl.pyx:6:23: Buffer types only
>> allowed as function local variables
>>
> 
> Sorry, I didn't test any code like that. I can guess where this got 
> introduced. Dag, any comments?

You guessed right :-)

I fixed this earlier, but only for native types (note that the int[] 
works ok); which obviously came from a wrong assumption. I'll find a way 
to fix it, check in the test case etc. etc.

However, there is of course the deeper question of overloading syntax 
like this. I don't think the [] syntax buys anything above a regular 
pointer notation? If so, removing support for int[]-notation altogether 
would get rid of the issue and lead to a cleaner grammar. What do people 
think? (Three choices: Good, bad, good but backwards compatability 
overrides it.)

(Anyway that can only happen after a round of deprecation warnings etc. 
so I'll definitely fix it.)

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

Reply via email to