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
Returning lazy lists from a start { } block results in empty list #3505
Comments
From @moritz<moritz> m: my @outer = 0..3; await my $x = start { eager @outer.map: Same result on the JVM. I guess this is related to the generator being scheduled on the old Anyway, it shouldn't silently swallow the contents of a lazy list. |
From @moritzFudged tests are in t/spec/S17-promise/start.t |
From @jnthnOn Sat Sep 06 06:31:08 2014, moritz wrote:
After the GLR, it whined about the Seq already having been iterated. I've now fixed that (turns out Promise!keep was actually sinking the Seq). Note that it's important to use the value that comes back from await, *not* to have the await in sink context and then call .result. Why? Because then you end up sinking the thing that await hands back. So, this (after my fix) is now fine: my @outer = 0..3; say await start { @outer.map: *+1 } This even with my fix isn't (by design) going to work: my @outer = 0..3; Since a Seq is one-shot. You can create this situation easily enough without Promises being involved, however - that's the nature of Seq. Corrected tests unfuged in S17-promise/start.t, and added another one golfed from an example on IRC. |
The RT System itself - Status changed from 'new' to 'open' |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#122715 (status was 'resolved')
Searchable as RT122715$
The text was updated successfully, but these errors were encountered: