Lisandro Dalcin wrote:
> On Tue, May 5, 2009 at 6:28 PM, Stefan Behnel wrote:
>> I meant
>>
>> cdef MyType(object) [(T,V)]:
>>
>> here, although I now noticed that there is already the "private type" syntax:
>>
>> cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:
>> ...
>>
>> so this won't work straight away either...
>>
>
> But this would work anyway, right?
Not that easily. You could have both [] parts next to each other, or just
any one of them. So the parser would fail if you decided to call your
template variable "type", which isn't that a bad name in this context.
> Perhaps you could even support {}
> for the [type ..., object ...] part...
>
> cdef public class MyBaseClass[T,V] [type MyBaseClass_Type, object
> MyBaseClassObject ]:
>
> cdef public class MyClass[T,V](MyBaseClass)[ type MyClass_Type, object
> MyClassObject ]:
Well, if we get to change *that* syntax (which I'd do straight away if it
wasn't for compatibility - it really hurt my eyes the first time I saw it),
then this seems a lot better:
cdef public class MyClass[T,V](MyBaseClass,
public_ctype="MyClass_Type",
public_cobject="MyClassObject"):
The parser can easily know and check all valid keywords here, so there'd be
no change to the rest of the compiler. And using strings as arguments makes
it a lot clearer (at least to me) that this is only configuration that is
supposed to end up in the generated C code, and not meant for real use in
the program.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev