New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Something wrong with LEAVE phaser in while loop #3324
Comments
From mark@kli.org
<camelia> rakudo-parrot 535d91: OUTPUT«===SORRY!===Error <camelia> ..rakudo-jvm 535d91, rakudo-moar 535d91, niecza
|
From @usev6Well, the error for rakudo.parrot is gone: $ perl6-p -e 'my $i=0; while $i < 3 { LEAVE { last }; say $i++; }' 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++; }' 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++; }' $ perl6-m -e 'my $i=0; while $i < 3 { LEAVE { say "bye!" }; say $i++; }' Or even with 'redo': $ perl6-p -e 'my $i=0; while $i < 3 { LEAVE { redo }; say $i++; }' $ perl6-m -e 'my $i=0; while $i < 3 { LEAVE { redo }; say $i++; }' |
1 similar comment
From @usev6Well, the error for rakudo.parrot is gone: $ perl6-p -e 'my $i=0; while $i < 3 { LEAVE { last }; say $i++; }' 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++; }' 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++; }' $ perl6-m -e 'my $i=0; while $i < 3 { LEAVE { say "bye!" }; say $i++; }' Or even with 'redo': $ perl6-p -e 'my $i=0; while $i < 3 { LEAVE { redo }; say $i++; }' $ perl6-m -e 'my $i=0; while $i < 3 { LEAVE { redo }; say $i++; }' |
@usev6 - Status changed from 'new' to 'open' |
From @cokeOn Sun Nov 23 00:48:59 2014, bartolin@gmx.de wrote:
15:53 <[Coke]> r: my $i=0; while $i < 6 { LEAVE { last }; say $i++; } 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 } The original ticket was about parrot, but that's not currently a supported backend. Closable with tests. -- |
From @cokeOn Mon Aug 03 13:00:39 2015, coke wrote:
Whoops, here are the other examples - the bye sample works fine... 16:01 <[Coke]> r: my $i=0; while $i < 3 { LEAVE { say "bye!" }; say $i++; } And the redo, as expected, now loops infinitely (deliberately redoing the block each time after completing the block...). 16:02 <[Coke]> r: my $i=0; while $i < 3 { LEAVE { redo }; say $i++; } -- |
From @usev6< bartolin_> r: my $str; my $i = 0; while $i < 2 { LEAVE { last }; $i++; $str ~= ~$i; }; say $str; $str = ""; $i = 0; while $i < 2 { LEAVE { $str ~= "leaving" }; $i++; $str ~= ~$i; }; say $str Test was added to S04-phasers/in-loop.t with commit Raku/roast@7ce647a18a The strange thing is, that the second while loop (which fails on JVM, see above) works as expected if executed "stand alone": $ perl6-j -e 'my $str = ""; my $i = 0; while $i < 2 { LEAVE { $str ~= "leaving" }; $i++; $str ~= ~$i; }; say $str' |
1 similar comment
From @usev6< bartolin_> r: my $str; my $i = 0; while $i < 2 { LEAVE { last }; $i++; $str ~= ~$i; }; say $str; $str = ""; $i = 0; while $i < 2 { LEAVE { $str ~= "leaving" }; $i++; $str ~= ~$i; }; say $str Test was added to S04-phasers/in-loop.t with commit Raku/roast@7ce647a18a The strange thing is, that the second while loop (which fails on JVM, see above) works as expected if executed "stand alone": $ perl6-j -e 'my $str = ""; my $i = 0; while $i < 2 { LEAVE { $str ~= "leaving" }; $i++; $str ~= ~$i; }; say $str' |
Migrated from rt.perl.org#121145 (status was 'open')
Searchable as RT121145$
The text was updated successfully, but these errors were encountered: