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

whitespace issue. was: loop fails (when followed by for ?) #938

Closed
p6rt opened this issue Apr 22, 2009 · 7 comments
Closed

whitespace issue. was: loop fails (when followed by for ?) #938

p6rt opened this issue Apr 22, 2009 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Apr 22, 2009

Migrated from rt.perl.org#64974 (status was 'rejected')

Searchable as RT64974$

@p6rt
Copy link
Author

p6rt commented Apr 22, 2009

From lode.leroy@gmail.com

perl version​: rakudo-d0a5de55a1da8c7307e6c486fd9b548fcbc0b727.tar.gz
parrot version​: 1.1.0

I tried this​:


loop(my $i=0; $i<10; $i++) {
  print "$i";
};
print "\n";


then this​:


for (0..10) ->$x {
  print "$x";
};
print "\n";


both of these work. but when I put them in the same file, like this​:


loop(my $i=0; $i<10; $i++) {
  print "$i";
};
print "\n";

for (0..10) ->$x {
  print "$x";
};
print "\n";


it doesn't work...

Redeclaration of variable $i
Redeclaration of variable $i
Statement not terminated properly at line 1, near "(my $i=0; "

current instr.​: 'parrot;PGE;Util;die' pc 129
(runtime/parrot/library/PGE/Util.pir​:85)
called from Sub 'parrot;Perl6;Grammar;eat_terminator' pc 76062
(src/gen_grammar.pir​:2531)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 74719
(src/gen_grammar.pir​:1997)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 72152
(src/gen_grammar.pir​:981)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 66891 (src/gen_setting.pir​:13146)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 665
(src/PCT/HLLCompiler.pir​:402)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 428
(src/PCT/HLLCompiler.pir​:303)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 920
(src/PCT/HLLCompiler.pir​:521)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1275
(src/PCT/HLLCompiler.pir​:690)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1470
(src/PCT/HLLCompiler.pir​:791)
called from Sub 'parrot;Perl6;Compiler;main' pc 24292 (perl6.pir​:164)

@p6rt
Copy link
Author

p6rt commented Apr 23, 2009

lode.leroy@gmail.com - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Apr 23, 2009

From lode.leroy@gmail.com

actually, adding a space in the code fixes it,

<<<-----------------------------------------
loop(my $i=0; $i<10; $i++) {
===-----------------------------------------
loop(my $i=0; $i <10; $i++) {

-----------------------------------------

@p6rt
Copy link
Author

p6rt commented Apr 23, 2009

lode.leroy@gmail.com - Status changed from 'open' to 'new'

@p6rt
Copy link
Author

p6rt commented Aug 12, 2009

From @kyleha

Thanks for your bug submission!

On Wed Apr 22 07​:09​:42 2009, lleroy wrote​:

-----------------------------------------
loop(my $i=0; $i<10; $i++) {
print "$i";
};
print "\n";

for (0..10) ->$x {
print "$x";
};
print "\n";
-----------------------------------------

it doesn't work...

This dies because $i<...> is interpreted as a postcircumfix​:<...>
operator (due to the greater-than in the for loop). In an ambiguous
case like this, white space around the infix operator (less-than) is
required, so the code is broken as written. The same thing happens if
the greater-than is in a comment like so​:

loop (my $i=0; $i<10; $i++) { say $i } # >

Since this is behaving as expected, I'm rejecting this bug.

@p6rt
Copy link
Author

p6rt commented Aug 12, 2009

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

@p6rt
Copy link
Author

p6rt commented Aug 12, 2009

@kyleha - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Aug 12, 2009
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant