Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parenthesized `for` loop is eager, even with `lazy` keyword #6007

Closed
p6rt opened this issue Jan 17, 2017 · 8 comments
Closed

Parenthesized `for` loop is eager, even with `lazy` keyword #6007

p6rt opened this issue Jan 17, 2017 · 8 comments
Labels

Comments

@p6rt
Copy link

@p6rt p6rt commented Jan 17, 2017

Migrated from rt.perl.org#130572 (status was 'resolved')

Searchable as RT130572$

@p6rt
Copy link
Author

@p6rt p6rt commented Jan 17, 2017

From @smls

  ➜ 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.

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 26, 2017

From @smls

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.

@p6rt
Copy link
Author

@p6rt p6rt commented May 12, 2019

From @dogbert17

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 rakudo/rakudo@cf1673d
the second case now works as intended.

@p6rt
Copy link
Author

@p6rt p6rt commented May 12, 2019

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

@p6rt p6rt commented May 12, 2019

From @dogbert17

On Sun, 12 May 2019 07​:36​:16 -0700, jan-olof.hendig@​bredband.net wrote​:

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
rakudo/rakudo@cf1673d
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

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 1, 2019

From @usev6

Back in 2017 jnthn++ already added a test for lazy for loops with Raku/roast@3659ede. Since the evaluations in this ticket also take the type into considerations, I've added a new test to S32-list/seq.t with Raku/roast@207171b

I'm closing this ticket as 'resolved'.

1 similar comment
@p6rt
Copy link
Author

@p6rt p6rt commented Aug 1, 2019

From @usev6

Back in 2017 jnthn++ already added a test for lazy for loops with Raku/roast@3659ede. Since the evaluations in this ticket also take the type into considerations, I've added a new test to S32-list/seq.t with Raku/roast@207171b

I'm closing this ticket as 'resolved'.

@p6rt
Copy link
Author

@p6rt p6rt commented Aug 1, 2019

@usev6 - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this Aug 1, 2019
@p6rt p6rt added the testcommitted label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.