On 10/15/2016 01:26 PM, janko popov (via RT) wrote: > # New Ticket Created by janko popov > # Please include the string: [perl #129884] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=129884 > > > > Hi, > > Maybe this is known bug, maybe not :-) But I cannot finding it on > https://rt.perl.org. > I found very strange behaviour on "say". > If we run code below then the "test" not appeared, but if we uncomment row > #say 'run'; > the "test" appeared. > > # This is Rakudo version 2016.07.1 built on MoarVM version 2016.07 > # implementing Perl 6.c. > # Linux 4.2.0-42-generic #49~14.04.1-Ubuntu SMP Wed Jun 29 20:22:11 UTC > 2016 x86_64 x86_64 x86_64 GNU/Linux > > sub test { > loop (my $i = 0; $i < 10; ++$i) { > loop (my $j = 0; $j < 10; ++$j) { > say 'test'; > } > } > #say 'run'; > } > > test;
This is about lazy lists and sinking. When you make the loop the not-last line, it'll be the return value of the sub. Tbh, i would have expected the call to test in sink context (i.e. not assigning anything) to cause the full execution of that loop.