Skip Menu |
Report information
Id: 117635
Status: resolved
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: coke <will [at] coleda.com>
Cc: timk <timk [at] jtimothyking.com>
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: dependant invocations of gather/take in same sub forced to complete in order
Date: Tue, 16 Apr 2013 23:32:04 -0400
To: rakudobug [...] perl.org
From: Will Coleda <will [...] coleda.com>
Download (untitled) / with headers
text/plain 828b
... instead of each only taking what they need. This sample demonstrates a problem found in S04-statements/gather.t that was until recently marked as "nom regression" - if the 13 below is a Whatever, @sixes[0] will never complete, waiting for @evens to terminate.

💈  cat gather.t
sub grep-div(@a, $n) {
    gather for @a {
        say "DIV BY $n, VALUE $_";
        take $_ if $_ %% $n;
    }
}

my @evens := grep-div((1...13), 2);
my @sixes := grep-div(@evens, 6);
say @sixes[0];

💈  ./perl6 gather.t
DIV BY 2, VALUE 1
DIV BY 2, VALUE 2
DIV BY 2, VALUE 3
DIV BY 2, VALUE 4
DIV BY 2, VALUE 5
DIV BY 2, VALUE 6
DIV BY 2, VALUE 7
DIV BY 2, VALUE 8
DIV BY 2, VALUE 9
DIV BY 2, VALUE 10
DIV BY 2, VALUE 11
DIV BY 2, VALUE 12
DIV BY 2, VALUE 13
DIV BY 6, VALUE 2
DIV BY 6, VALUE 4
DIV BY 6, VALUE 6
6


--
Will "Coke" Coleda
Download (untitled) / with headers
text/plain 1018b
On Tue Apr 16 20:32:30 2013, coke wrote: Show quoted text
> ... instead of each only taking what they need. This sample demonstrates a > problem found in S04-statements/gather.t that was until recently marked as > "nom regression" - if the 13 below is a Whatever, @sixes[0] will never > complete, waiting for @evens to terminate. > > 💈 cat gather.t > sub grep-div(@a, $n) { > gather for @a { > say "DIV BY $n, VALUE $_"; > take $_ if $_ %% $n; > } > } > > my @evens := grep-div((1...13), 2); > my @sixes := grep-div(@evens, 6); > say @sixes[0]; > > 💈 ./perl6 gather.t > DIV BY 2, VALUE 1 > DIV BY 2, VALUE 2 > DIV BY 2, VALUE 3 > DIV BY 2, VALUE 4 > DIV BY 2, VALUE 5 > DIV BY 2, VALUE 6 > DIV BY 2, VALUE 7 > DIV BY 2, VALUE 8 > DIV BY 2, VALUE 9 > DIV BY 2, VALUE 10 > DIV BY 2, VALUE 11 > DIV BY 2, VALUE 12 > DIV BY 2, VALUE 13 > DIV BY 6, VALUE 2 > DIV BY 6, VALUE 4 > DIV BY 6, VALUE 6 > 6 > >
After fixing a scoping bug, the spectest in question now passes. Unfudged it; resolving ticket.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org