Robert Bradshaw wrote:

> The issue here is handling something like
> 
> cdef A x
> cdef A(type=cdef int) y = x # this needs to be able to do type  
> checking at runtime

Hmmm. I think I would be happy if you could only do things
like that for type parameters which are Python types, not
C types.

It may help to disallow writing a bare declaration like

   cdef A x

if A has any unspecified type parameters. In the case of
C types, you would have to commit yourself to some concrete
type, and then the compiler can perform type checking.

In the case of Python types, you could write things like

   cdef A(object) x
   cdef A(Foo) y
   y = x

and a run-time type test would be done on the type parameters.

If you went on to say

   cdef A(int) z
   y = z

this would be a compile-time error, since a C int can never
be a subclass of Foo.

Or perhaps, as you say, something like ctypes could be used to
provide a runtime representation of C types.

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

Reply via email to