J2 decorator grammar

Michael Sparks zathras at thwackety.com
Sat Aug 21 18:53:01 EDT 2004


On Fri, 20 Aug 2004, Robert Brewer wrote:

[ given grammar ]
...
> > Would you consider this instead?

After I fix the scoping issue I'll consider lots of things. The second
version holds more weight though :)

> Did you ever fix the scope issue?

I'm working on it at the moment. (Interesting way to start looking at the
source tree :) Based on very helpful comments in the source the sequence
that happens is the symbol tables get defined, then on a second pass,
things are done in a more detailed fashion using these tables.

Upshot is at the moment this:

class Foo:
   #staticmethod

   decorate:
      staticmethod
   def Hoo(who):

Results in just Foo and Hoo being picked up, with staticmethod "hidden" in
the indented block, whereas this:

class Foo:
   staticmethod

   decorate:
      staticmethod
   def Hoo(who):

Result in Foo, Hoo and staticmethod being picked up - presumably because
they're in easily accessible blocks.

Likewise the @pie syntax falls into the second category, as does the
current 2.3 style of Hoo=staticmethod(Hoo) approach.

> Might it have something to do with:
>
> static void
> symtable_node(struct symtable *st, node *n)

I've tried this change, but whilst it doesn't work it's a useful avenue -
thanks :)

Regards,


Michael.





More information about the Python-list mailing list