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

Ranges appear to modify readonly lexicals in pointy nested for loops #1014

Closed
p6rt opened this issue Jun 4, 2009 · 5 comments
Closed

Ranges appear to modify readonly lexicals in pointy nested for loops #1014

p6rt opened this issue Jun 4, 2009 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 4, 2009

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

Searchable as RT66280$

@p6rt
Copy link
Author

p6rt commented Jun 4, 2009

From @cjfields

This is a nasty one. Using a Range with a lexical in an inner for
block with nested pointy block modifies the lexical.

IRC link​:

http://irclog.perlgeek.de/perl6/2009-06-04#i_1208694

Was occurring as of Rakudo 77db80 (on IRC).

Simple test cases​:

pyrimidine1​:bioperl6 cjfields$ perl6

for 1,3 -> $i { my $tmp = $i; for $tmp,4 -> $j { say "($j;$i)"};
$i.say }
(1;1)
(4;1)
1
(3;3)
(4;3)
3
for 1,3 -> $i { for $i..4 -> $j { say "($j;$i)"}; $i.say }
(1;5)
(2;5)
(3;5)
(4;5)
5
(3;5)
(4;5)
5
for 1,3 -> $i { for 1..4 -> $j { say "($j;$i)"}; $i.say }
(1;1)
(2;1)
(3;1)
(4;1)
1
(1;3)
(2;3)
(3;3)
(4;3)
3

cjfields (aka pyrimidine)

@p6rt
Copy link
Author

p6rt commented Jun 4, 2009

From @cjfields

First example should have been (w/o $tmp assignment)​:

for 1,3 -> $i { for $i,4 -> $j { say "($j;$i)"}; say $i};
(1;1)
(4;1)
1
(3;3)
(4;3)
3

@p6rt
Copy link
Author

p6rt commented Jun 4, 2009

From @pmichaud

Now fixed in 9e2b9ad​:

  $ cat 66280
  for 1,3 -> $i {
  for $i..4 -> $j { say "$j,$i" };
  $i.say;
  }
  $ ./perl6 66280
  1,1
  2,1
  3,1
  4,1
  1
  3,3
  4,3
  3
  $

Test added to range.t. Closing ticket, thanks!

Pm

1 similar comment
@p6rt
Copy link
Author

p6rt commented Jun 4, 2009

From @pmichaud

Now fixed in 9e2b9ad​:

  $ cat 66280
  for 1,3 -> $i {
  for $i..4 -> $j { say "$j,$i" };
  $i.say;
  }
  $ ./perl6 66280
  1,1
  2,1
  3,1
  4,1
  1
  3,3
  4,3
  3
  $

Test added to range.t. Closing ticket, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Jun 4, 2009

@pmichaud - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Jun 4, 2009
@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