Hi, Thinking about how to implement Cython decorators (@cclass, @cfunc etc.) for pure Python mode, I come up with an idea of "compile-time decorator". Basically, we want these decorators to have effect during compile time, rather than normal Python decorator that is called in runtime. So, to implement @cfunc, we can actually implement a function cfunc(node), which inputs a DefNode and transform it to a CFuncDefNode, then put the function into the compile-time scope.
Cython directives could also be dealt in this way. This may even extend to a kind of plugin framework, which allows user to write their compile-time decorator. A problem is in which phase these decorators should be called. I guess it should be somewhere between DecoratorTransform and AnalyseDeclarationsTransform, but would that be too late for compiler directives? Any comment about this? Thanks! -- Haoyu BAI School of Computing, National University of Singapore. _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
