Thomas E Enebo wrote:
What's the correct way to initialise a top-level static scope - is it:

StaticScope scope = new LocalStaticScope(null);

or something else?

Yep.  That is fine.  In general it does not matter for
LocalStaticScopes based on my explanation above as to how variables
resolve for scoping.  LocalStaticScopes act like top-level scopes in
places that have them.

The only caveat here is constant lookup; with a null parent scope it will dig no deeper than this scope when looking up constants. Normally all scopes should eventually terminate at the top-level script scope, but I think deviating from this behavior would only reduce the number of scopes scanned for constants.

Are class and method body scopes considered top-level or should a method
body scope have the class scope as an enclosing scope? Or does this answer
depend on closures.

LocalStaticScope is top or local variable scope resolution.  We create
these for every scope which is not a block.

See above; the parent for a LocalStaticScope is not used for variable resolution but is used for constant resolution.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email


Reply via email to