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

multiple use of "my $" in the same scope warns about redeclaration #2011

Closed
p6rt opened this issue Aug 4, 2010 · 7 comments
Closed

multiple use of "my $" in the same scope warns about redeclaration #2011

p6rt opened this issue Aug 4, 2010 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Aug 4, 2010

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

Searchable as RT76986$

@p6rt
Copy link
Author

p6rt commented Aug 4, 2010

From @bbkr

[12​:13] <bbkr> rakudo​: my $ = 'a'; my $ = 4; # hmm
[12​:14] <p6eval> rakudo efe72c​: OUTPUT«===SORRY!===â�¤Redeclaration of symbol $
at line 22, near " = 4; # hm"�»
[12​:15] <sorear> my $ = 5 is absolutely legal
[12​:15] <sorear> it creates an anonymous variable
[12​:15] <sorear> it's most useful in parameter lists
[12​:16] <sorear> it prevents unused variable warnings
[12​:27] <bbkr> i know that "my $ = 5" is legal. still "my $ = 'a'; my $ = 4;"
IMO should not warn about redeclaration, because symbol is anonymous :)
[12​:27] <moritz_> rakudo​: my $ = 5; my $ = 7; say "alive"
[12​:28] <p6eval> rakudo efe72c​: OUTPUT«===SORRY!===â�¤Redeclaration of symbol $
at line 22, near " = 7; say "�»
[12​:28] <bbkr> same as ([1,2,3], [1,2,3]) is legal code and those are two
anonymous arrays in the same scope
[12​:28] <moritz_> bbkr​: that's right; it's a bug

@p6rt
Copy link
Author

p6rt commented Oct 4, 2011

From @coke

Same behavior in rakudo 7408d6.

--
Will "Coke" Coleda

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 4, 2011

From @coke

Same behavior in rakudo 7408d6.

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Oct 4, 2011

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Dec 1, 2011

From @bbkr

2011.11 works, marking as testneeded

$ perl6 -e 'my $ = 2; my $ = 3; say "alive"'
alive

@p6rt
Copy link
Author

p6rt commented Jan 16, 2012

From @moritz

Now tested in integration/error-reporting.t

@p6rt
Copy link
Author

p6rt commented Jan 16, 2012

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

@p6rt p6rt closed this as completed Jan 16, 2012
@p6rt p6rt added the testneeded 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
Development

No branches or pull requests

1 participant