Yes, I think it's too late, especially as there seems to be a little  
of knowledge on how the two are used and interact, and I'd rather be  
very cautions at this point. Hopefully 0.12 won't be too far behind.

It might be worth rethinking having two separate keywords to  
accomplish the same thing in different ways (though I would not be  
surprised if there's good reason, but it might just be historical).  
It'd be nice if someone who actually uses these features speaks up.  
Also, this probably has implications on using Cython for core NumPy  
modules/functions.

On Sep 25, 2009, at 9:35 AM, Lisandro Dalcin wrote:

> Try to cythonize, this and you will get a failure (second last line,
> in Foo2 type declaration)..
>
> cdef public     void bar1(): pass
> cdef        api void bar2(): pass
> cdef public api void bar3(): pass
>
> ctypedef public     class Foo1 [type PyFoo1_Type, object  
> PyFoo1_Object]: pass
> ctypedef        api class Foo2 [type PyFoo2_Type, object  
> PyFoo2_Object]: pass
> ctypedef public api class Foo3 [type PyFoo3_Type, object  
> PyFoo3_Object]: pass
>
>
> Cython currently has two ways of *exporting* C-API's for third-party
> consumption...
>
> The first way, related to the "public" keyword, is based on
> DL_EXPORT/DL_IMPORT stuff and CROSS-LINKING extension modules. I've
> never ever did this, I'm not sure about how much portable this
> approach is; distutils does not any provides support for this; no idea
> how this works on Windows (I do not even know if it actually works).

Actually, me either.

> The second way, releated to the "api" keyword, is based on standard
> Python import mechanism, it is AFAIK portable to every platform Python
> runs on; is the documented, recommended way to implement C-API
> exporting, and moreover core CPython does this following this approach
> (e.g. cStringIO in Python 2).
>
> So IMHO, we should be able to remove that nasty restriction that 'cdef
> api class' does not work because it ALSO requires the 'public'
> declaration.
>
> Related to C code (source and headers) generation, the safer thing to
> do for next release is to provide both way of exporting if any or both
> of 'public' and 'api' is used for cdef class declaration...

Does anyone know any cases where one could be used, and not the  
other? Currently, public is a bit odd, as it's also used in an  
unrelated context to expose cdef attributes. I'm all for simplifying  
this.

- Robert

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

Reply via email to