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
Constant Seq in a loop not reinitialized #5186
Comments
From @awwaiidHere is an example that works as expected: > for ^2 { my $n = 5; say [+] (^$n X ^$n) } If we use constants to construct the Seq, it is not re-created on the > for ^2 { say [+] (^5 X ^5) } In my particular case after building the Seq I was applying map and grep to > for ^2 -> $n { say [+] (^5 X ^5).map(* + $n) } I don't feel that the suggested .cache is appropriate, but maybe I'm wrong? Note that if I manually unrolled this loop I wouldn't get the error (since |
From @zoffixznetStill present in Rakudo version 2016.07.1-19-g8dff9df built on MoarVM version 2016.07-3-gc01472d $ ./perl6-m -e 'for ^2 { say [+] (^5 X ^5) }' -- |
The RT System itself - Status changed from 'new' to 'open' |
From @jnthnOn Sun Mar 20 08:30:28 2016, awwaiid wrote:
Yeah, it was a constant folding issue. I've now made sure we don't try to do that for things that produce a Seq, which fixes the issue. Test added to S03-metaops/cross.t. |
@jnthn - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#127749 (status was 'resolved')
Searchable as RT127749$
The text was updated successfully, but these errors were encountered: