Stéfan van der Walt wrote:
> I think I may have to switch to structs instead of classes, but then I
> no longer have convenient methods or array members.  Maybe I should
> rewrite my class to have many static methods that operate on a struct,
> and then collect the structs as data instead of the full instances.

Technically it would not be too difficult to allow

cdef struct MyStruct:
    void foo(self):
        # self is pure MyStruct, perhaps stack-allocated

in Cython, and transform

mystructinstance.foo()

into

__mangled_MyStruct_foo(mystructinstance)

The question is whether we want it or not, perhaps it would just be
confusing to provide OO-like syntax on something that's neither reference
counted nor polymorphic.

Also the line has to be drawn somewhere before we rewrite C++ :-) So I
don't know what I think about it myself, but it's not too difficult
technically.

Dag Sverre

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

Reply via email to