On May 13, 2009, at 8:52 AM, Lisandro Dalcin wrote:
> I've partially implemented the @cython.callspec("something") stuff. It
> actually solves my particular needs, but it not all the possible
> needs. The problem is that the calling convention spec is part of the
> type of the function, and a general solution should handle the code
> below:
>
> @cython.callspec("something")
> cdef void myfunc(): pass
>
> @cython.callspec("something")
> cdef void (*p)()
>
> p = myfunc
>
> But then the decoration on the function pointer "p" IMHO deviates too
> much for the normal Python meaning of decorators...
How so? A decorator takes an object and returns a new object (in this
case, with a new type).
> The only possibility I can imagine up to now is something like:
>
> cdef void callspec("something") myfunc(): pass
>
> cdef void (callspec("something") *p)()
>
> p = myfunc
>
>
> Of course, this approach requires modification to the parser, and the
> syntax could be controversial. However, the addition of callspec() as
> a declarator modifier (like inline or extern) taking a single arg
> would remove all the ambiguities of my original proposal of using a
> bare string literal...
I like this better than the original proposal, but still prefer the
decorator approach.
- Robert
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev