# New Ticket Created by  Patrick R. Michaud 
# Please include the string:  [perl #56512]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56512 >


This is a meta-ticket on which we can hang other tickets
related to the ongoing lexical issues in Rakudo and Parrot.

As of r28892, Rakudo cannot handle lexical access from subs
nested in immediate blocks, as in:

    $ cat x
    {
        my $x = 'ok';
        say "outer ", $x;
        sub foo() { say "inner ", $x; }
        foo();
    }
    $ ./parrot perl6.pbc x
    outer ok
    inner
    $

The underlying difficulty is described in RT#56184 -- calling an
immediate sub or block from within a closure causes it to lose
its outer lexical scope.

Of course, in the above Perl 6 code there shouldn't be any
closures present -- but PCT traditionally generated all
immediate blocks as closures because otherwise lexical
variables tend to not work at all.  And, of course, it's
trivial to modify the above Perl 6 example such that the
immediate block _is_ a closure.  (Thus far my attempts to
get PCT to not use closures for immediate blocks have failed
due to this and other lexical issues, such as RT#56274 and :lexid .)

Since there are many tests in the suite that use immediate
blocks to locally declare variables for a given set of tests,
this is a bit of a blocker for Rakudo.

It's also a bit of a blocker for enabling proper handling
of the "special" variables $_, $!, and $/ .

Pm

Reply via email to