Skip to content
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

'next' or 'last' don't trigger LEAVE phaser in loop in Rakudo #2806

Closed
p6rt opened this issue Jul 2, 2012 · 7 comments
Closed

'next' or 'last' don't trigger LEAVE phaser in loop in Rakudo #2806

p6rt opened this issue Jul 2, 2012 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jul 2, 2012

Migrated from rt.perl.org#113950 (status was 'resolved')

Searchable as RT113950$

@p6rt
Copy link
Author

p6rt commented Jul 2, 2012

From @masak

<masak> r​: loop { last; LEAVE say "bye!" }; say "outside"
<p6eval> rakudo 16db64​: OUTPUT«outside␤»
<masak> do we have this one on file?
<masak> closest I find is https://rt-archive.perl.org/perl6/Ticket/Display.html?id=113548
* masak submits rakudobug
<masak> r​: for ^10 { next; LEAVE say "yay!" }; say "outside"
<p6eval> rakudo 16db64​: OUTPUT«outside␤»
<masak> that, too.
<masak> n​: loop { last; LEAVE say "bye!" }; say "outside"
<p6eval> niecza v19-7-g5e25209​: OUTPUT«bye!␤outside␤»
<masak> n​: for ^10 { next; LEAVE say "yay!" }; say "outside"
<p6eval> niecza v19-7-g5e25209​:
OUTPUT«yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤outside␤»

Niecza has the behavior I'd expect from Rakudo.

@p6rt
Copy link
Author

p6rt commented Apr 5, 2013

From @coke

On Mon Jul 02 07​:02​:11 2012, masak wrote​:

<masak> r​: loop { last; LEAVE say "bye!" }; say "outside"
<p6eval> rakudo 16db64​: OUTPUT«outside␤»
<masak> do we have this one on file?
<masak> closest I find is
https://rt-archive.perl.org/perl6/Ticket/Display.html?id=113548
* masak submits rakudobug
<masak> r​: for ^10 { next; LEAVE say "yay!" }; say "outside"
<p6eval> rakudo 16db64​: OUTPUT«outside␤»
<masak> that, too.
<masak> n​: loop { last; LEAVE say "bye!" }; say "outside"
<p6eval> niecza v19-7-g5e25209​: OUTPUT«bye!␤outside␤»
<masak> n​: for ^10 { next; LEAVE say "yay!" }; say "outside"
<p6eval> niecza v19-7-g5e25209​:
OUTPUT«yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤outside␤»

Niecza has the behavior I'd expect from Rakudo.

Behavior has changed; we're half right​:

20​:02 < [Coke]> r​: loop { last; LEAVE say "bye!" }; say "outside"
20​:02 <+p6eval> rakudo 604986​: OUTPUT«===SORRY!===␤Error while compiling block
  : Error while compiling op call​: Error while compiling block :
  Error while compiling op bind​: Error while compiling op while​:
  Error while compiling block : Error while compiling op
  p6return​: Operation 'p6return' requires 1 o…
20​:03 < [Coke]> r​: for ^10 { next; LEAVE say "yay!" }; say "outside"
20​:03 <+p6eval> rakudo 604986​:
OUTPUT«yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤yay!␤outside␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Apr 5, 2013

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 23, 2014

From @usev6

As noted in April 'next' triggers LEAVE phaser as expected.

With 'last' there is no longer an error, but the LEAVE phaser is still not triggered (same output on Moar, Parrot and JVM)​:

$ perl6 -e 'loop { last; LEAVE say "bye!" }; say "outside"'
outside

I added two tests (the one for 'last' is fuged 'todo') to S04-phasers/enter-leave.t with commit Raku/roast@bba16ae7e0

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 23, 2014

From @usev6

As noted in April 'next' triggers LEAVE phaser as expected.

With 'last' there is no longer an error, but the LEAVE phaser is still not triggered (same output on Moar, Parrot and JVM)​:

$ perl6 -e 'loop { last; LEAVE say "bye!" }; say "outside"'
outside

I added two tests (the one for 'last' is fuged 'todo') to S04-phasers/enter-leave.t with commit Raku/roast@bba16ae7e0

@p6rt
Copy link
Author

p6rt commented Jun 20, 2015

From @jnthn

On Sun Nov 23 00​:10​:12 2014, bartolin@​gmx.de wrote​:

As noted in April 'next' triggers LEAVE phaser as expected.

With 'last' there is no longer an error, but the LEAVE phaser is still
not triggered (same output on Moar, Parrot and JVM)​:

$ perl6 -e 'loop { last; LEAVE say "bye!" }; say "outside"'
outside

I added two tests (the one for 'last' is fuged 'todo') to S04-
phasers/enter-leave.t with commit
Raku/roast@bba16ae7e0

Was an optimizer issue; it over-eagerly flattened away the loop block, losing the exit handler in the process. Fixed, and test unfudged.

@p6rt
Copy link
Author

p6rt commented Jun 20, 2015

@jnthn - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 20, 2015
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant