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

Differring behaviours when using an outer-scope-declared var before declaring it in current scope #6462

Open
p6rt opened this issue Aug 22, 2017 · 2 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Aug 22, 2017

Migrated from rt.perl.org#131945 (status was 'new')

Searchable as RT131945$

@p6rt
Copy link
Author

p6rt commented Aug 22, 2017

From @zoffixznet

I'd expect all three have the same behaviour (likely the last one, that cries about already-bound symbols)​:

  my int $x = 42;
  { say $x; my int $x = 70; }
  # OUTPUT​: 0 (no errors)

  my int $y = 42;
  { say $y; my $y = 70; }
  # OUTPUT​:
  # ===SORRY!===
  # Cannot take a reference to a non-native lexical

  my $z = 42;
  { say $z; my $z = 70; }
  # ===SORRY!=== Error while compiling /home/zoffix/devbox/tmp/C/exercises/f.p6
  # Lexical symbol '$z' is already bound to an outer symbol;
  # the implicit outer binding must be rewritten as OUTER​::<$z>
  # before you can unambiguously declare a new '$z' in this scope
  # at /home/zoffix/devbox/tmp/C/exercises/f.p6​:12
  # ------> { say $z; my $z⏏ = 70; }
  # expecting any of​:
  # constraint

@p6rt
Copy link
Author

p6rt commented Aug 22, 2017

From @zoffixznet

$ perl6 -v
This is Rakudo version 2017.07-22-g02667bd built on MoarVM version 2017.07
implementing Perl 6.c.

@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant