On Fri, Jun 23, 2006 at 01:16:22PM -0700, Chip Salzenberg wrote:
> On Fri, Jun 23, 2006 at 08:27:04AM -0700, jerry gay wrote:
> > audreyt++ pointed out on #parrot that there doesn't seem to be a way
> > to specify where to start finding lexicals, in support of perl's
> > OUTER::. eg. (from S04):
> >    my $x = $OUTER::x;
> > or
> >    my $x = OUTER::<$x>;
> 
> So OUTER:: is a -starting- point of one scope up?  I thought it was a
> specific notation that the $x you want is exactly one scope up, and if you
> wanted two scopes up, you had to ask for OUTER::OUTER::<$x>.

My understanding is that $OUTER::x means "$x as it appears in the 
outer lexical scope".  In Perl 6 code, this means:

    { 
        my $x = 4;
        {
             my $y = 7;
             {
                 my $x = 9;
                 say $x;                  # outputs 9
                 say $OUTER::x;           # outputs 4
                 say $OUTER::OUTER::x;    # same thing
             }
        }
    }

S02 says this in a somewhat roundabout way:

    The current lexical symbol table is now accessible 
    through the pseudo-package MY.  [...] The OUTER name refers 
    to the MY symbol table immediately surrounding the current 
    MY, and OUTER::OUTER is the one surrounding that one.

I interpret the first sentence as meaning that the "MY" pseudo-package
refers to all of the symbols in the current lexical scope, not 
just those that have been explicitly declared in the current scope 
using "my".

However, if there's confusion on this point then perhaps we should
kick the question to p6l or #perl6 for clarification.

Pm

Reply via email to