Skip Menu |
Report information
Id: 130572
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: smls75 [at] gmail.com
Cc:
AdminCc:

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



To: rakudobug [...] perl.org
Date: Tue, 17 Jan 2017 16:13:21 +0100
From: "Sam S." <smls75 [...] gmail.com>
Subject: Parenthesized `for` loop is eager, even with `lazy` keyword
➜ say (for ^4 { .say }).WHAT; 0 1 2 3 (List) ➜ say (lazy for ^4 { .say }).WHAT; 0 1 2 3 (Seq) I would have expected an output of just `(Seq)` in both cases, or at least in the second case. The synopses don't seem to make a statement on whether a `List` or `Seq` should be returned, but S04 is quite clear that both should be lazy <https://design.perl6.org/S04.html#line_688>: lazy loops can be indicated by putting the loop in parens or brackets: (... if COND for LIST) # lazy list comprehension [for LIST { ... }] (loop { ... }) or by use of either a statement prefix or a phaser in statement form: lazy for LIST { ... } ENTER for LIST { ... } According to bisectable and committable <https://gist.github.com/dd0b5601f4198d88bbfd8dc746d7eb25>, Rakudo has always done it like it does now, though. --- This is Rakudo version 2016.12-315-gdaf7e5185 built on MoarVM version 2016.12-113-gd1da1bac implementing Perl 6.c.
Download (untitled) / with headers
text/plain 135b
This bug is still present in Rakudo version 2017.08-8-g753c9a5ea built on MoarVM version 2017.08.1-19-g151a2563 implementing Perl 6.c.


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