Stefan Behnel wrote:
> Dag Sverre Seljebotn wrote:
>   
>> A directive to warn/give error on any undeclared variables? I.e.:
>>
>> @cython.warning_undeclared(True)
>> def foo():
>>     cdef object a
>>     cdef int b
>>     a = b = c  = 3 # warns that "c" is not declared and auto-typed to object
>>     
>
> Fine with me. There are really cases where you want a function to be "all
> C", and you want to be sure it stays that way.
>
> Regarding the infrastructure, what about an abstract transform hat
> intercepts on specific Cython compiler directives. The reason is that I
> think we'll need this more often, e.g. for a test directive that asserts
> certain features of the parsed/transformed/optimised source tree. It should
> just delegate the respective subtree to another transform (or even tree
> visitor) and let that do the rest.
In this specific case I think I'd tend to add a few lines in 
analyse_target_type (or whatever) in NameNode I think, without using a 
transform (where the directives in effect are available in 
env.directives or similar -- which is kind of a hack as the scope info 
is mutated as the tree is traversed, but it is a solution until we start 
passing "ctx" instead of "env").

I like the general idea though (only concern is that combining multiple 
compiler directives etc. into one pass is sometimes going to be faster, 
although less clean).

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

Reply via email to