Skip Menu |
Report information
Id: 121145
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: mark [at] kli.org
Cc:
AdminCc:

Severity: (no value)
Tag: testcommitted
Platform: (no value)
Patch Status: (no value)
VM: JVM



Date: Sun, 02 Feb 2014 09:56:51 -0500
From: "Mark E. Shoulson" <mark [...] kli.org>
To: rakudobug [...] perl.org
Subject: LTA message for parrot in phaser
<clsn> perl6: my $i=0; while $i < 6 { LEAVE { last }; say $i++; }
<camelia> rakudo-parrot 535d91: OUTPUT«===SORRY!===␤Error while compiling op p6return: Operation 'p6return' requires 1 operands, but got 2␤»
<camelia> ..rakudo-jvm 535d91, rakudo-moar 535d91, niecza v24-109-g48a8de3: OUTPUT«0␤»


RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 811b
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
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 1.4k
On Sun Nov 23 00:48:59 2014, bartolin@gmx.de wrote: Show quoted text
> 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
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 2.5k
On Mon Aug 03 13:00:39 2015, coke wrote: Show quoted text
> On Sun Nov 23 00:48:59 2014, bartolin@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.
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++; } 16:01 <camelia> rakudo-{moar,jvm} a38b59: OUTPUT«0␤bye!␤1␤bye!␤2␤bye!␤» 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++; } 16:02 <camelia> rakudo-jvm a38b59: OUTPUT«0␤1␤2␤3␤4␤5␤6␤7␤8␤9␤10␤11␤12␤13␤14␤15␤16␤17␤18␤19␤20␤21␤22␤23␤24␤25␤26␤27␤28␤29␤30␤31␤32␤33␤34␤35␤36␤37␤38␤39␤40␤41␤42␤43␤44␤45␤46␤47␤48␤49␤50␤51␤52␤53…» 16:02 <camelia> ..rakudo-moar a38b59: OUTPUT«(timeout)0␤1␤2␤3␤4␤5␤6␤7␤8␤9␤10␤11␤12␤13␤14␤15␤16␤17␤18␤19␤20␤21␤22␤23␤24␤25␤26␤27␤28␤29␤30␤31␤32␤33␤34␤35␤36␤37␤38␤39␤40␤41␤42␤43␤44␤45␤46␤47␤48␤49␤50␤51…» -- Will "Coke" Coleda
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 989b
< 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 <+camelia> rakudo-moar a38b59: OUTPUT«1␤1leaving2leaving␤» <+camelia> ..rakudo-jvm a38b59: OUTPUT«1␤␤» < bartolin_> [Coke]: ^^ alas, there still seems to be something wrong on JVM with RT #121145 < [Coke]> bartolin_: hokay. < [Coke]> We can at least add a test and make sure we don't regress on moar - don't have to get JVM 100% before christmas. < bartolin_> [Coke]: I'll add a test for that ... what you said Test was added to S04-phasers/in-loop.t with commit https://github.com/perl6/roast/commit/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' 1leaving2leaving


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org