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

Owner: Nobody
Requestors: cygx [at] cpan.org
Cc:
AdminCc:

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



Date: Fri, 9 Jun 2017 21:48:37 +0200
From: cygx <cygx.cpan [...] gmail.com>
Subject: [BUG] andthen weirdness with lexicals
To: rakudobug [...] perl.org
Download (untitled) / with headers
text/plain 493b
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
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 718b
On Fri, 09 Jun 2017 12:48:55 -0700, cygx@cpan.org wrote: Show quoted text
> 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: https://github.com/rakudo/rakudo/commit/1ee89b54074e80c Test: https://github.com/perl6/roast/commit/2f2998733a2d8132c


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