On Sun Nov 23 00:48:59 2014, barto...@gmx.de wrote:
> Well, the error for rakudo.parrot is gone:
> 
> $ perl6-p -e 'my $i=0; while $i < 3 { LEAVE { last }; say $i++; }'
> 0
> 
> But there is still something wrong with the LEAVE phaser in a while
> statement. First, the above command has a different output on
> rakudo.moar and rakudo.jvm:
> 
> $ perl6-m -e 'my $i=0; while $i < 3 { LEAVE { last }; say $i++; }'
> 0
> 1
> 2
> 
> Furthermore it looks like the statement in the LEAVE block isn't
> executed at all (but rakudo.parrot still breaks out of the while
> statement):
> 
> $ perl6-p -e 'my $i=0; while $i < 3 { LEAVE { say "bye!" }; say $i++;
> }'
> 0
> 
> $ perl6-m -e 'my $i=0; while $i < 3 { LEAVE { say "bye!" }; say $i++;
> }'
> 0
> 1
> 2
> 
> Or even with 'redo':
> 
> $ perl6-p -e 'my $i=0; while $i < 3 { LEAVE { redo }; say $i++; }'
> 0
> 
> $ perl6-m -e 'my $i=0; while $i < 3 { LEAVE { redo }; say $i++; }'
> 0
> 1
> 2

15:53 <[Coke]> r:  my $i=0; while $i < 6 { LEAVE { last }; say $i++; }
15:53 <camelia> rakudo-{moar,jvm} a38b59: OUTPUT«0␤»

This seems fine. To avoid confusion about whether the first loop should be 
saying 0 or 1, try this:

15:56 <[Coke]> r:  my $i=0; while $i < 6 { LEAVE { last }; $i = $i + 1; say $i }
15:56 <camelia> rakudo-{moar,jvm} a38b59: OUTPUT«1␤»

The original ticket was about parrot, but that's not currently a supported 
backend.

Closable with tests.

-- 
Will "Coke" Coleda

Reply via email to