On May 5, 2009, at 1:54 PM, Lisandro Dalcin wrote:

> On Tue, May 5, 2009 at 8:53 AM, Stefan Behnel <[email protected]>  
> wrote:
>>
>> Dag Sverre Seljebotn wrote:
>>>> 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
>>>>
>>
>> I wouldn't mind. We have a lot of convenience stuff in structs  
>> already
>> (e.g. dict coercion and keyword arguments), so adding methods with  
>> the
>> above semantics wouldn't hurt.
>
> I agree...

I wouldn't be opposed...

>
>> It's not rewriting C++ either, as long as it makes sense in Cython  
>> as a
>> language.
>>
>
> 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. We should  
look into making instantiating (cdef) classes faster by default as well.

- Robert

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

Reply via email to