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

No error on erroneous use of contextual lexical before its declaration in a scope in Rakudo #1731

Closed
p6rt opened this issue Apr 28, 2010 · 5 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 28, 2010

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

Searchable as RT74756$

@p6rt
Copy link
Author

p6rt commented Apr 28, 2010

From @masak

<masak> rakudo​: my $*a = 42; foo; sub foo { say $*a; my $*a }
<p6eval> rakudo 72f914​: OUTPUT«Any()␤»
<masak> what's a reasonable expectation here?
<masak> should it be a compile error?
<masak> std​: my $*a = 42; foo; sub foo { say $*a; my $*a }
<p6eval> std 30494​: OUTPUT«ok 00​:01 110m␤»
<PerlJam> masak​: re code above--error
<masak> PerlJam​: good. that's all I need to hear.
* masak submits rakudobug
<masak> rakudo​: say $*a; my $*a = 42
<p6eval> rakudo 72f914​: OUTPUT«Any()␤»
<masak> ah, that's an even simpler error case.
<jnthn> Probably wants to die at compile time.<masak> std​: my $a; {
say $a; my $a } # it's a bit like this, actually
<p6eval> std 30494​: OUTPUT«�[31m===�[0mSORRY!�[31m===�[0m␤Lexical
symbol '$a' is already bound to an outer symbol (see line 1);␤ the
implicit outer binding at line 1 must be rewritten as OUTER​::<$a>␤
before can unambiguously declare a new '$a' in this scope [...]
<jnthn> masak​: Right, it's exactly that.
<jnthn> masak​: Rakudo gets that wrong too - it'll be the same fix for both.
<masak> jnthn​: right. still reporting this one separately, just in case.

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

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

@p6rt
Copy link
Author

p6rt commented Oct 10, 2011

From @coke

Unchanged.

17​:00 < [Coke]> rakudo​: say $*a; my $*a = 42;
17​:00 <+p6eval> rakudo 38907e​: OUTPUT«Any()␤»

--
Will "Coke" Coleda

@p6rt
Copy link
Author

p6rt commented Jul 20, 2015

From @jnthn

On Mon Oct 10 14​:01​:28 2011, coke wrote​:

Unchanged.

17​:00 < [Coke]> rakudo​: say $*a; my $*a = 42;
17​:00 <+p6eval> rakudo 38907e​: OUTPUT«Any()␤»

Fixed now​:

$ perl6-m -e "say $*a; my $*a = 42;"
===SORRY!=== Error while compiling -e
Illegal post-declaration of dynamic variable '$*a';
earlier access must be written as CALLER​::<$*a>
if that's what you meant

Added test in S02-names-vars/contextual.t.

@p6rt p6rt closed this as completed Jul 20, 2015
@p6rt
Copy link
Author

p6rt commented Jul 20, 2015

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

@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