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

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

Severity: (no value)
Tag: testcommitted
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.
Download (untitled) / with headers
text/plain 340b
On Sat, 26 Aug 2017 05:15:41 -0700, smls75@gmail.com wrote: Show quoted text
> 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
As per commit https://github.com/rakudo/rakudo/commit/cf1673d9c20e82aad6291a8aa123c46e177edf34 the second case now works as intended.
Download (untitled) / with headers
text/plain 566b
On Sun, 12 May 2019 07:36:16 -0700, jan-olof.hendig@bredband.net wrote: Show quoted text
> On Sat, 26 Aug 2017 05:15:41 -0700, smls75@gmail.com wrote:
> > 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
> > As per commit > https://github.com/rakudo/rakudo/commit/cf1673d9c20e82aad6291a8aa123c46e177edf34 > the second case now works as intended.
As for the first case, see https://colabti.org/irclogger/irclogger_log/perl6-dev?date=2019-05-12#l48 should be set to testneeded
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 326b
Back in 2017 jnthn++ already added a test for lazy for loops with https://github.com/perl6/roast/commit/3659ede149. Since the evaluations in this ticket also take the type into considerations, I've added a new test to S32-list/seq.t with https://github.com/perl6/roast/commit/207171b5ee I'm closing this ticket as 'resolved'.


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