On Sun, Nov 9, 2014 at 1:29 PM, Nils Bruin <bruin.n...@gmail.com> wrote: > On Saturday, November 8, 2014 12:15:02 PM UTC-8, Sturla Molden wrote: >> >> Presumably Cython >> needs C and C++ function and method pointer syntax for wrapping C and C++ >> libraries, so why add another one? > > > I think that's a valid point. The reality is that one of cython's strength > is that interfacing with existing C/C++ libraries is extremely > straightforward. At some point this involves translating a ".h" into a > ".pxd" file. Having many C/C++ type designations be valid in cython is > therefore a generally desirable property (especially for the inscrutable > C/C++ ones!). Thus I don't think you'd want to *deprecate* type definitions > that are presently valid in C/C++ as well as in cython.
Even better would be a tool that automatically translates an .h file into a .pxd file (if the .pxd file is needed at all), pulling out all or specifically enumerated declarations. They'd only be edited by hand by experts. One could support something like from "signal.h" cimport signal rather than re-declare it. > The bar for *adding* > syntax for things that can already be expressed should be really quite high. > I'm not sure the proposal meets that bar for me. The proposal would > definitely benefit from a motivation that goes beyond "C/C++ is ugly and > hard to understand", because the reality is that cython won't be able to get > away from that entirely anyway. If you're wrapping C libraries, yes, but if you want to pass around a cdef function as a first class object as easily as you pass a standard Python callable, for people who don't already know C well. That is the use case I'm targeting, and I think the C function pointer syntax is particularly poorly suited for that. Again, I agree the "wrapping C libraries" case as a very important one we want to support, but disagree that a better syntax would be an undue burden (especially if most cases were automated away). This came up recently because I have also been toying with a formal grammar for Cython: https://github.com/robertwb/cython/blob/grammar/Cython/Parser/Grammar . Adding declarators here greatly complicates things (though feel free to try and do it cleanly). - Robert _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel