Eric Roode writes:
: Larry Wall writes:
: > I think if we have to go through contortions to get at the outer topic
: > by name, it's better to just name the variable on the outer loop in the
: > first place. Adding -> $varname to the outer loop is safe, because it
: > doesn't change the semantics of topicality--now that we changed the
: > rule so that $_ is always aliased to the topic regardless of whether
: > it's aliased to an explicit variable name.
: >
: > Larry
:
: This seems to argue against OUTER::
Yeah, but we need to have OUTER:: anyway if we want to support
my $foo = $OUTER::foo;
And we need that because, unlike in Perl 5, the new $foo is introduced
immediately, not at the end of the statement. And the reason for that
is so that something like
my &foo = sub { foo() }
can recognize that recursion is supposed to happen. (We didn't have to
deal with that in Perl 5 because we didn't have lexical subroutines.)
Anyway, as I said earlier, I made $OUTER::foo ugly on purpose. I
particularly want people to start to gnash their teeth when they type
$OUTER::OUTER::foo, because it means they're being lazy in the wrong way.
Larry