On Mon Oct 27 21:55:46 2014, pmichaud wrote:
> This is a reminder/placeholder ticket for a bug I found tonight while
> researching GLR-related topics.  A "for" loop executed in sink context
> isn't executing its block in sink context.  From #perl6:
> 
> 04:50 <pmichaud> m:  class Sinker { method sink() { say "Blub" } };
> my $i = 0; while $i < 5 { $i++; Sinker.new(); }; 1
> 04:50 <camelia> rakudo-moar 315ec6: OUTPUT«Blub␤Blub␤Blub␤Blub␤Blub␤»
> 04:50 <pmichaud> m:  class Sinker { method sink() { say "Blub" } };
> for ^5 { Sinker.new(); }; 1
> 04:50 <camelia> rakudo-moar 315ec6: ( no output )
> 
> Earlier in the conversation:
> 
> 00:38 <pmichaud> ...which one is "correct"?  (post-GLR)
> 00:41 <pmichaud> i.e., does a loop executed in sink context execute
> its body in sink context?
> 03:16 <TimToady> pmichaud: why would a loop in sink context ever want
> a value from its loop body?
> 03:16 <TimToady> I'm a bit surprised the 2nd one isn't sunk already
> 03:21 <TimToady> well, not really, given what I know about internals
> :)
> 04:39 <pmichaud> TimToady: I'm not surprised the second one isn't sunk
> already; sink context in Rakudo is (still) somewhat inconsistently
> handled.
> 04:40 <pmichaud> Implementors sometimes remembered to throw away the
> values, but forgot to tell the values they were being thrown away.
> 04:41 <pmichaud> anyway, I'll be looking at fixing that shortly
> 
> The bug will likely be taken care of as part of the GLR; this ticket
> is to remind us that we need a test for it.  :)
> 
> Pm

behavior updated, consistent currently in nom and glr.

15:11 < [Coke]> m:  class Sinker { method sink() { say "Blub" } };  my $i = 0;
                while $i < 5 { $i++; Sinker.new(); }; 1
15:11 <+camelia> rakudo-moar 6a1879: OUTPUT«WARNINGS:␤Useless use of constant
                 integer 1 in sink context (line 1)␤Blub␤Blub␤Blub␤Blub␤Blub␤»
15:11 < GLRelia> rakudo-moar a977dc: OUTPUT«WARNINGS:␤Useless use of constant
                 integer 1 in sink context (line 1)␤Blub␤Blub␤Blub␤Blub␤Blub␤»
15:11 < [Coke]> m:  class Sinker { method sink() { say "Blub" } };  for ^5 {
                Sinker.new(); }; 1
15:11 <+camelia> rakudo-moar 6a1879: OUTPUT«WARNINGS:␤Useless use of constant
                 integer 1 in sink context (line 1)␤»
15:11 < GLRelia> rakudo-moar a977dc: OUTPUT«WARNINGS:␤Useless use of constant
                 integer 1 in sink context (line 1)␤»

-- 
Will "Coke" Coleda

Reply via email to