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


Parrot seems to have a problem with lexical handling.  Consider
the following Perl 6 code:

    use v6;
    
    {
        my $count = 1;
        sub foo {
            say "-->", $count, "<--";
        }
        foo();
    }

When run using Rakudo Perl, the $count in sub foo comes back as null.

    $ ./parrot perl6.pbc x
    --><--
    $

Here's a simplified PIR version of the above that exhibits the
same bug:

    $ cat x.pir
    .sub "main"
        get_global $P10, "_block16"
        newclosure $P10, $P10
        $P34 = $P10()
        .return ($P34)
    .end
    
    .sub "_block16"  :outer("main")
        new $P22, "Integer"
        assign $P22, 1
        .lex "$count", $P22
        $P33 = "foo"()
        .return ($P33)
    .end
    
    .sub "foo"  :outer("_block16")
        find_lex $P29, "$count"
        print "-->"
        print $P29
        print "<--\n"
    .end
    
    $ ./parrot x.pir
    -->Null PMC access in get_string()
    current instr.: 'foo' pc 42 (x.pir:21)
    called from Sub '_block16' pc 31 (x.pir:13)
    called from Sub 'main' pc 11 (x.pir:4)
    $

Pm

Reply via email to