On Wed, Mar 20, 2013 at 12:41:41PM -0700, Carl Mäsak wrote: > # New Ticket Created by "Carl Mäsak" > # Please include the string: [perl #117235] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=117235 > > > <masak> just found my heisenbug :) > <masak> yeah, this is a weird one. > <diakopter> run it? > <masak> rn: my $c = [[1]].map({ [ @$_ ] }); $c.push( 42 ); say $c.perl > <p6eval> rakudo 9be4cc, niecza v24-35-g5c06e28: OUTPUT«([1], 42).list.item» > <masak> rn: my $c = [[1]].map({ [ @$_ ] }); $c.unshift( 42 ); say $c.perl > <p6eval> rakudo 9be4cc: OUTPUT«(42,).list.item» > <p6eval> ..niecza v24-35-g5c06e28: OUTPUT«(42, [1]).list.item» > * masak submits rakudobug > <masak> rn: my $c = [[1], [2], [3]].map({ [ @$_ ] }); $c.unshift( 42 > ); say $c.perl > <p6eval> niecza v24-35-g5c06e28: OUTPUT«(42, [1], [2], [3]).list.item» > <p6eval> ..rakudo 9be4cc: OUTPUT«(42,).list.item» > > Niecza is right throughout, of course. The .unshift method adds > elements; it doesn't remove them.
The problem is apparently with sink context, not .unshift. I have a temporary fix in mind, but can't get to it until Wednesday night or Thursday night. 20:26 <pmichaud> I wonder if the problem is related to sink context. 20:26 <pmichaud> r: my $c = [[1],[2],[3]].map( { $_ } ); $c.unshift(42).say 20:26 <p6eval> rakudo 9be4cc: OUTPUT«42 1 2 3» 20:26 <pmichaud> $c.unshift(42); is being evaluated in sink context. 20:26 <moritz> that might be it 20:27 <pmichaud> r: my $c = [[1],[2],[3]].map( { $_ } ); $c.unshift(42).sink; say $c.perl; 20:27 <p6eval> rakudo 9be4cc: OUTPUT«(42,).list.item» 20:27 <pmichaud> there ya go. 20:27 <moritz> niecza doesn't implement sink context 20:27 <masak> huh. 20:28 <pmichaud> r: my $c = [[1],[2],[3]].map( { $_ } ); $c.sink; say $c.perl; 20:28 <p6eval> rakudo 9be4cc: OUTPUT«().list.item» 20:29 <moritz> pmichaud: c4083c42f2e63c97254b7a215a858913c4ff4a44 is the relevant merge commit 20:29 <pmichaud> golfed. Pm