On Thu Dec 25 06:49:28 2008, masak wrote:
> Rakudo r34342 sometimes destroys the original object when running
> .clone(). This works:
> 
> $ cat right.p6 class A { has $.b; }
> my @q = A.new( :b(1) );
> my $p = shift @q;
> $p.clone( :b($p.b + 1) );
> say $p.b;
> 
> $ perl6 right.p6
> 1
> 
> But when a while loop is introduced, the original object is changed:
> 
> $ cat wrong.p6
> class A { has $.b; }
> my @q = A.new( :b(1) );
> while shift @q -> $p {
>     $p.clone( :b($p.b + 1) );
>     say $p.b;
> }
> 
> $ perl6 wrong.p6
> 2

I think this is pretty much the same as a bug I fixed earlier today.
Anyway, it now in latest Rakudo gives 1, which is the Right Answer, so
resolving. :-)

Thanks,

Jonathan

Reply via email to