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 phaser doesn't fire from inside an ENTER phaser in a loop in Rakudo #3695

Closed
p6rt opened this issue Feb 20, 2015 · 4 comments
Closed

NEXT phaser doesn't fire from inside an ENTER phaser in a loop in Rakudo #3695

p6rt opened this issue Feb 20, 2015 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Feb 20, 2015

Migrated from rt.perl.org#123894 (status was 'rejected')

Searchable as RT123894$

@p6rt
Copy link
Author

p6rt commented Feb 20, 2015

From @masak

<masak> m​: for 1..2 { ENTER { my $t = (^1000).roll; say "Setting up
$t"; NEXT say "Tearing down $t" }; say "Processing..." }
<camelia> rakudo-moar 114659​: OUTPUT«Setting up
471␤Processing...␤Setting up 449␤Processing...␤»
<masak> I'm surprised the NEXT one above doesn't show "Tearing down <n>"
<moritz> masak​: you didn't call next; did you?
<masak> m​: for 1..2 { ENTER { my $t = (^1000).roll; say "Setting up
$t"; NEXT say "Tearing down $t" }; say "Processing..."; next }
<camelia> rakudo-moar 114659​: OUTPUT«Setting up
984␤Processing...␤Setting up 97␤Processing...␤»
<masak> moritz​: I don't think I have to.
<masak> moritz​: there's like an implicit `next` at the end of a loop.
* masak submits rakudobug
<PerlJam> m​: for 1..2 { ENTER { my $t = (^1000).roll; say "Setting up
$t"; next; NEXT say "Tearing down $t" }; }
<camelia> rakudo-moar 114659​: OUTPUT«Setting up 349␤Setting up 651␤»
<PerlJam> even with the next ...
<PerlJam> :)
<PerlJam> m​: for 1..2 { ENTER { my $t = (^1000).roll; say "Setting up
$t"; NEXT say "Tearing down $t" }; next; }
<camelia> rakudo-moar 114659​: OUTPUT«Setting up 606␤Setting up 552␤»
<PerlJam> huh
<masak> m​: for 1..2 { NEXT say "hup!" }
<camelia> rakudo-moar 114659​: OUTPUT«hup!␤hup!␤»
<masak> m​: for 1..2 { ENTER { NEXT say "hup!" } }
<camelia> rakudo-moar 114659​: ( no output )

I would expect a NEXT phaser to bind to the loop and trigger even in
the cases where it's declared inside of another phaser, such as ENTER.

@p6rt
Copy link
Author

p6rt commented Apr 12, 2015

From @jnthn

On Fri Feb 20 06​:47​:10 2015, masak wrote​:

I would expect a NEXT phaser to bind to the loop and trigger even in
the cases where it's declared inside of another phaser, such as ENTER.

Your expectation is off, I think. Phasers are block traits, and so apply to the block they are written in. Rejected; may be re-opened only if you can find a clear statement in the design docs that this should work, but I suspect it should not given that (a) these kinds of things introduce weird scoping issues in general, and (b) it hurts implementing constructs that want to do their own processing of phasers.

@p6rt
Copy link
Author

p6rt commented Apr 12, 2015

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

@p6rt p6rt closed this as completed Apr 12, 2015
@p6rt
Copy link
Author

p6rt commented Apr 12, 2015

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

@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