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

andthen weirdness with lexicals #6340

Closed
p6rt opened this issue Jun 9, 2017 · 4 comments
Closed

andthen weirdness with lexicals #6340

p6rt opened this issue Jun 9, 2017 · 4 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 9, 2017

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

Searchable as RT131548$

@p6rt
Copy link
Author

p6rt commented Jun 9, 2017

From cygx@cpan.org

Example code​:

  $ cat bug.p6
  for ^7 {
  my $x = 1;
  1 andthen print "$x "
  andthen $x = 2
  andthen $x = 3
  andthen $x = 4;
  }

Output​:

  $ perl6 bug.p6
  1 4 3 3 3 3 3

We apparently create a closure over the wrong value of $x.

  $ perl6 --version
  This is Rakudo version 2017.05-356-gac8b4714f built on MoarVM version 2017.05-50-g6a372ac4
  implementing Perl 6.c.

See also https://irclog.perlgeek.de/perl6/2017-06-09#i_14711768

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

From @zoffixznet

On Fri, 09 Jun 2017 12​:48​:55 -0700, cygx@​cpan.org wrote​:

Example code​:

$ cat bug.p6
for ^7 {
my $x = 1;
1 andthen print "$x "
andthen $x = 2
andthen $x = 3
andthen $x = 4;
}

Output​:

$ perl6 bug.p6
1 4 3 3 3 3 3

We apparently create a closure over the wrong value of $x.

$ perl6 --version
This is Rakudo version 2017.05-356-gac8b4714f built on MoarVM version
2017.05-50-g6a372ac4
implementing Perl 6.c.

See also https://irclog.perlgeek.de/perl6/2017-06-09#i_14711768

Thank you for the report. This is now fixed.

Fix​: rakudo/rakudo@1ee89b54074e80c
Test​: Raku/roast@2f2998733a2d8132c

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

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

@p6rt
Copy link
Author

p6rt commented Jan 26, 2018

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

@p6rt p6rt closed this as completed Jan 26, 2018
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant