On Mon, Nov 10, 2014 at 1:10 PM, Dima Pasechnik <dimpase+git...@gmail.com> wrote: > On 10 November 2014 20:23, Robert Bradshaw <rober...@gmail.com> wrote: >> On Mon, Nov 10, 2014 at 6:25 AM, Dima Pasechnik <dimp...@gmail.com> wrote: >>> On 2014-11-06, Robert Bradshaw <rober...@gmail.com> wrote: >>>> I'd like to propose a more pythonic way to declare function pointer >>>> types, namelye >>>> >>>> type0 (*[ident])(type1, type2, type3) >>>> >>>> would instead become >>>> >>>> (type1, type2, type3) -> type0 [ident] >>>> >>>> I have a pull request up at https://github.com/cython/cython/pull/333; >>>> what do people think? >>> >>> we had a discussion with Volker about this few weeks ago - in my Cython >>> code I >>> needed to do, as he suggested, a workaround like this: >>> >>> int* vlamatrix "(int (*)[])" (int*) # a hack to get int (*)[] through >>> cython >>> >>> This was for 2-dim arrays of variable length, and looks similar to the >>> stuff here. >>> >>> IMHO it would be good to address this, too. >> >> Yeah. >> >>> I'd rather stick to C99 conventions in Cython. >>> To me, using '->' for types looks way too close to what is used, with >>> different semantics, in functional languages like Haskell or Coq. >> >> Actually, the proposed use of '->' *is* identical to Haskell in >> semantics, i.e. "int -> int" is how you write a function taking and >> returning an int. Of course in Python one has a single argument tuple >> as input rather than currying. > > well, I don't really see why ident is put at the end of the statement. > As you know, Haskell-like it would be > > ident :: (type1, type2, type3) -> type0 > > if you work in postscript, then indeed putting ident at the end > would be natural :-)
Ident is put at the end because changing that would be much, much more invasive, e.g. "cdef a, b, c [token] int", though there are definitely advantages of doing it that way. _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel