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

'for' loops in phasers in 'for' loops don't run in Rakudo #3022

Closed
p6rt opened this issue Jan 6, 2013 · 5 comments
Closed

'for' loops in phasers in 'for' loops don't run in Rakudo #3022

p6rt opened this issue Jan 6, 2013 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 6, 2013

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

Searchable as RT116314$

@p6rt
Copy link
Author

p6rt commented Jan 6, 2013

From @masak

<phenny> grondilu​: 03 Jan 21​:53Z <masak> tell grondilu also, I can't
reproduce the bug you seem to be compensating for in
http://rosettacode.org/mw/index.php?title=Average_loop_length&diff=149566&oldid=149562
-- old rakudo?
<grondilu> rn​: for ^2 { FIRST { .say for <foo bar> }; .say }
<p6eval> ..rakudo a93058​: OUTPUT«0␤1␤»
* masak submits rakudobug
<masak> grondilu++
<masak> I'm running 2012.11-95-g8a1836b locally, and it works there.
<masak> so it's a relatively new regression.
* masak was the one with the old rakudo, it turns out :)
<grondilu> :)
<masak> r​: for ^2 { FIRST { say "hah!" }; .say }
<p6eval> rakudo a93058​: OUTPUT«hah!␤0␤1␤»
<timotimo> "how to implement simple things into rakudo" :P
<masak> r​: for ^2 { FIRST { .say for 4 }; .say }
<p6eval> rakudo a93058​: OUTPUT«0␤1␤»
<masak> r​: for ^2 { LAST { .say for 4 }; .say }
<p6eval> rakudo a93058​: OUTPUT«0␤1␤»
<masak> r​: for ^2 { LAST { say "hah!" }; .say }
<p6eval> rakudo a93058​: OUTPUT«0␤1␤hah!␤»
<masak> r​: for ^2 { ENTER { .say for 4 }; .say }
<p6eval> rakudo a93058​: OUTPUT«0␤1␤»
<masak> r​: for ^2 { LEAVE { .say for 4 }; .say }
<p6eval> rakudo a93058​: OUTPUT«0␤1␤»

The expectation is that it shouldn't matter whether there is a 'for'
loop inside the phaser or not; it should still run.

@p6rt
Copy link
Author

p6rt commented Jan 6, 2013

From @masak

<moritz> masak​: fwiw https://rt-archive.perl.org/perl6/Ticket/Display.html?
id=116314 is about the phasers not being put in sink context properly
<masak> moritz​: show me your reasons for believing this.
<moritz> masak​: for loops are lazy, and only run in eager or sink context
<moritz> masak​: so if normal statements are run, but for loops aren't,
sink context is missing
* masak adds this to the ticket

@p6rt
Copy link
Author

p6rt commented Jan 6, 2013

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 8, 2014

From @usev6

for loops in phasers in for loops are run now​:

for 1..2 { ENTER { .say for <foo bar> }; .say}
foo
bar
1
foo
bar
2

I added a test to S04-phasers/enter-leave.t with the following commit​: Raku/roast@0a2c9a8008

@p6rt p6rt closed this as completed Oct 8, 2014
@p6rt
Copy link
Author

p6rt commented Oct 8, 2014

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

@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