Robert wrote:
>One thing I like about this syntax is that it allows one to write a  
>single piece of code that handles the generic (value only known at  
>runtime) case and can be optimized if the value is known at compile  
>time.

Indeed, that's what I liked about it. What I dislike is the exact way the type 
parameters are put into fields of the same name. (It basically means that the 
caller decides what is compile-time values and not, and things can easily get 
"out of sync", if method implementations depends on them being runtime?)

What about this modification:

cdef A(len=10) a

then "a" is considered assignable "any instance of A which had len=10 passed to 
the constructor" (or instances which are willing to convert to that). The 
constructor can then decide how to assign the values to fields (or entirely 
drop them for compile-time treatment). Might require smart inlining of the 
constructor in perhaps impossible ways though, I'm waving my hands and will 
think more...

That also solves the  overloaded syntax problems -- () always do in fact refer 
to the constructor...

Don't take this post too seriously, have to think more...

Dag Sverre

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

Reply via email to