Robert Bradshaw wrote:
> On May 5, 2009, at 1:54 PM, Lisandro Dalcin wrote:
>> But them someone will ask for polimorphism, and then the struct
>> instances could have a pointer to a struct-specific vtable, and then
>> you are more or less rewriting C++. And that would not bother me,
>> currently cdef methods do work as a sort C++, right?.
>
> Yeah, I'm not sure how far one wants to take this though.

I think a good point to stop is where we have to change the struct itself.
Adding a vtable to it would be rather surprising for users as it could
break stuff. We can do with cdef classes what we want, but C structs
should stay the way they are defined in user code.

Adding 'methods' to them is a rather straight transform in Cython that
does not impact the generated C code, so that's just fine.


> We should
> look into making instantiating (cdef) classes faster by default as well.

Different topic, but surely worth it (and worth a ticket). It might work
to always use PY_NEW() for instantiation and then generate a separate (and
direct) call to __init__() only if the type defines it.

Stefan

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

Reply via email to