On Thu, Nov 13, 2008 at 03:21:45PM -0800, Carl Mäsak wrote: > Rakudo r32629 sometimes dies when assigning a readonly variable to > itself, and sometimes not. > > $ ./perl6 -e 'for <a b c> -> $foo { $foo = $foo; say $foo }' # dies, good > Cannot assign to readonly variable. > [...] > > $ ./perl6 -e 'for split(/<sp>/, "a b c") -> $foo { $foo = $foo; say > $foo }' # baaaahd! > a > b > c
There's a bit more going on behind the scenes here -- the "$foo = $foo" line in the second case is also promoting Parrot String values into Rakudo Str objects. I suspect that promotion is causing the readonly property on $foo to be lost. My guess is that we want to adjust Parrot's C<copy> opcode so that it doesn't modify the destination PMC's properties. Thanks, Pm