Clinton Pierce wrote:

        set P1[0], P0
        getstdout P0            # <-- bug is here?  Overwrote my P0.
        set P1[1], P0


Yep a bug is here. But this bug is a BASIC compiler bug. Things that go into aggregates (or are stored in lex pads/global tables) are stored by reference. You have to clone PMCs to get independed vars:

.sub _main
        $P0 = new PerlArray
        $P1 = new PerlString
        $P1 = "ok\n"
        $P0[0] = $P1
        $P1 = "no\n"
        $P0[1] = $P1
        $P2 = $P0[0]
        $P3 = $P0[1]
        print $P2
        print $P3
        end
.end

$ parrot pierce.imc
no
no


leo





Reply via email to