Robert Bradshaw wrote: > On Nov 27, 2008, at 12:46 PM, Dag Sverre Seljebotn wrote: >> Proposal: New modifier, "proto". I.e. >> >> cdef proto int foo(int a, int b): >> cdef int c >> cdef int b >> >> will embed the signature/variables on a pure >> >> def foo(a, b): ... >> >> If the keyword proto is not present, the definition is not allowed >> unless it is declared inline. >> >> Pro: >> - Resolve the conflict. >> - I think this makes it more obvious what is going on. I think having >> the pxd definition transfer to a def in the pyx/py is a bit too >> magical >> using the current syntax anyway, and that this is an improvement, >> conflict or not. >> >> Con: >> - Breaks compatability with Cython 0.10 (but through compiler >> errors, no >> silently changed behaviour). >> >> What do you think? I could implement it in roughly five minutes if >> it is >> accepted, the function modifier part of the parser is nice and >> dynamic. > > I'm generally -1 on adding new syntax, but what I had wasn't very > clear either. Would it be enough to accept a locals decorator?
That's much better; +1. Could you do it? You did this so it should be quicker for you. At any rate this is now http://trac.cython.org/cython_trac/ticket/143 Note that this may require extending decorator support (in Parsing.py) to cdef functions, currently they only support "def" (if you didn't change that already). They should all probably simply be let through no matter what they decorate, and then disallowed again (except for @cython.locals) in PostParse. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
