Hi, Danilo Freitas wrote: > To let people know better here, the syntax for defining C++ classes is > (using an example file for tests): > > cdef extern from "foo.h" namespace something: #namespace is optional
I would prefer seeing from that header line that this block deals with C++. Enforcing that wouldn't hurt users, but improve readability, and make it easier to expand the block content to potential future syntax extensions that aren't allowed for C definitions. > cdef cppclass Foo: > int do_something(int) Fine with me, but what about overloaded signatures? That also impacts the constructor. > cdef cppclass Foo2(Foo): #inheritance allowed > pass Sure. > cdef Foo *make_Foo(): > pass > > cdef Foo2 *make_Foo2() Would that be a regular factory function or a way to write the constructor? > We can declare methods inside the class without the cdef, so, taking > this to constructors and operators should be allowed too. ok > Also, objects declared inside a C++ class are taken as C types (Python > objects not allowed) Why not? They'd map to a PyObject*, which Cython code would ref-count its access to. If you change it from C++ code, you'd just be on your own, as usual. Same for the C++ destructor, which Cython won't generate for you. Call it an advanced feature. Stefan _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
