Dave Mitchell wrote:
>
> Here's a list of what any Perl 6 implementation of lexicals must be able to
> cope with (barring additions from future apocalyses). Can anyone think of
> anything else?
I would like
perl -le 'my $Q = 3; {local $Q = 4; print $Q}'
to print 4 instead of crashing in confusion. In other words,
have a lexical shadow a temporary (that's what we decided to call
locals, right?) when the temporary is asking for a name that has
been associated with a lexical.
Doing this takes two pieces. The first piece is package-justifying
any argument to C<local> before replacing symbols with scratchpad
lookup hooks. The second is creating a lexical to hide the same-named
enclosing lexical and making it an alias to the new temporary.
perl -le'$Q=2;my$Q=3;print do{local$main::Q=4;($Q,$main::Q)},$Q,$main::Q'
Or did I miss the meeting where it was declared that temporaries
are just history.
It is not a big deal any way; can't think of a situation where this
would be useful.
--
David Nicol 816.235.1187
Refuse to take new work - finish existing work - shut down.