On May 6, 2009, at 10:06 PM, Dag Sverre Seljebotn wrote: > Robert Bradshaw wrote: >> On May 6, 2009, at 1:33 PM, Dag Sverre Seljebotn wrote: >>> OTOH, if heap-allocation-and-refcounted semantics isn't selected, >>> one >>> should use "cdef struct" instead, like Lisandro suggests. >> >> Structs are also something different (well, there's a lot of >> similarity, but the idea of inheritance is a big one), especially if >> we're looking at heap allocated classes for the first iteration. (I >> don't think we want to try to do our own refcounting, let the user >> use new and delete directly if they want to use C++.) > > Well, they are not something different in C++ :-)
A C++ class is a glorified struct, but one still has plain old structs too. > If you don't want to try your own refcounting, please, please tell > me that > the only allowed form of usage of the class will be > > cdef CppClass* obj This is what I imagined (for now at least). > Allowing > > cdef CppClass obj > > in any form and requiring a manual delete would be very confusing and > difficult to remember. > > (That's what I mean by refcounting -- I imagined the difference > between > these two syntaxes would be that the latter of these would be > refcounted; > and subject for automatic stack-allocation-optimization.) By "refcounting", are you implying global garbage collection of some sort, just like Python objects, or something that emulates being on the stack (e.g. objects are deleted when the scope exits, and all assignments are done by value)? - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
