On Apr 11, 2008, at 6:17 PM, Lisandro Dalcin wrote:

> On 4/11/08, Robert Bradshaw <[EMAIL PROTECTED]>
>
>>  What if the error message made it very clear in the (compile  
>> time) error
>> message that a function declared foo(void) in c should be declared  
>> foo() in
>> Cython? Would that be sufficient?
>
> Yes, regarding all your comments, I now believe that the best is to
> just generate a better error mensage

OK, I'll put this on my todo list.

>> because I hope that most copy/paste style declarations can be handled
>> automatically (e.g. one could just write cinclude "header.h" and  
>> it would
>> find all the functions/constants, though this would not be near as
>> powerful).
>
> Nice! thats a nice feature. But then, in that case, the parser HAVE to
> accept the void foo(void) inside a C header file, right?

Yes. Note that this not yet implemented (and will be a fair amount of  
work) and will not necessarily be as good as a hand written one.

>>  BTW, any specific reason you took these discussions off-list (as  
>> I think
>> they would be general interest?)
>
> Ups! just because I simply pick 'reply' in Gmail, and you continued
> the thread writting to me and CC'ing to the list. In other mailing
> lists configuration, the 'reply-to' is by default set to the list.
>
> BTW, why cython-devel list does not specify a 'reply-to' by default
> being the list itself?

This has annoyed me too, but it just now hit me that I could probably  
go in and change it. Done.

- Robert


>>> On 4/11/08, Robert Bradshaw <[EMAIL PROTECTED]> wrote:
>>>
>>>> On Apr 11, 2008, at 3:53 PM, Lisandro Dalcin wrote:
>>>>
>>>>
>>>>> Whats the rationale of the following being illegal in Cython?
>>>>>
>>>>> cdef extern from "bar.h":
>>>>>    void foo(void)
>>>>>
>>>>>
>>>>
>>>>  This is only because foo() is the way to specify a function  
>>>> with no
>>>> arguments in Python. it is more useful to think of Cython as  
>>>> Python (+some
>>>> static declarations) than to try and think of it as being a
>>>> syntactically-different variant of C.
>>>>
>>>>
>>>>
>>>>> If I'm not wrong, in a C context (but not C++), the declarations
>>>>>
>>>>> void foo(void);
>>>>> void foo();
>>>>>
>>>>> are not equivalent, the second is actually means something like
>>>>>
>>>>> void foo(...)
>>>>>
>>>>>
>>>>
>>>>  It's even worse, it means "I'm just to lazy to tell you what the
>> arguments
>>>> are, but if you use the wrong ones bad things could happen."  
>>>> IIRC it's
>> only
>>>> around for historical reasons and officially discouraged by ANSI  
>>>> C, and
>> it
>>>> would be bad (in my opinion) to allow such archaic and confusing  
>>>> notions
>>>> into Cython.
>>>>
>>>>
>>>>
>>>>> Anyway, as  void foo(void) is a valid C (C++?) function  
>>>>> declaration, I
>>>>> would ask for that form being legal in Cython, unless there is  
>>>>> a some
>>>>> technical issue like leading to an ambiguous grammar.
>>>>>
>>>>>
>>>>
>>>>  If we allow foo() and foo(void) in Cython then people might  
>>>> wonder if
>> the
>>>> two have different meanings (as they do in C), and such a  
>>>> declaration
>> might
>>>> look confusing to a Python developer. On the other hand, it will  
>>>> make it
>>>> easier to do copy-pasting from header files (which will  
>>>> eventually, I
>> hope,
>>>> could be automated in many cases).
>>>>
>>>>  - Robert
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>>
>
>
> -- 
> 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

Reply via email to