# New Ticket Created by Patrick R. Michaud
# Please include the string: [perl #123072]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/Ticket/Display.html?id=123072 >
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«BlubBlubBlubBlubBlub»
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