On 6/23/06, Chip Salzenberg <[EMAIL PROTECTED]> 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>.
from #perl6:
13:21| audreyt: ?eval my $x = 3; { { say $OUTER::x } }
13:21| evalbot_10746: OUTPUT[3 ] Bool::True
boy, it's nice to have a reference implementation! yes, OUTER:: starts
the lookup one scope up.
Hm: what -is- the meaning of OUTER::OUTER::<$x> -- search starting two
scopes up, going as far as needed?
indeed.
my $x = 3; { { say $OUTER::x} } # 3
> i propose this should be specified using a three-arg form of find_lex
> <find_lex_p_s_i> where the third parameter is an integer specifying
> which level in the lexical chain to start the lookup.
I'm not fond of numeric scope counts, but they are cheap and solve this
specific problem. So, OK, and thanks for driving this with a test.
--
great, thanks!
~jerry