> 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:

Thanks for clearing this up.  In my head I was confused between the difference in, 
say, "new PerlHash" which creates a brand new PerlHash and sets a Px register to that 
new PerlHash so I can say:

        $P0=new PerlHash
        $P1=new PerlArray
        $P0["foo"]=$P1
        $P1=new PerlArray
        $P0["bar"]=$P2

where the PerlHash has references to two different arrays, as opposed to things like 
getstd(in|out|err):

        $P1=new PerlArray
        getstdin $P0
        $P1[0]=$P0
        getstdin $P0    # Oops.
        $P1[1]=$P0

Where $P0 keeps getting re-used by getstdin and the same reference gets shoved into 
the PerlArray each time.

I suppose PMC authors (or opcode authors?) should be pretty clear on whether they're 
re-using the same PMC or cloning up a new one.  


Reply via email to