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

Rakudo throws a parse error instead of (like STD) a warning upon same-scope redeclaration of a variable #2348

Closed
p6rt opened this issue Feb 5, 2011 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Feb 5, 2011

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

Searchable as RT83430$

@p6rt
Copy link
Author

p6rt commented Feb 5, 2011

From @masak

<jaffa4> Is redeclaration of a variable allowed in Perl 6?
<masak> std​: my $a; my $a
<p6eval> std 625303c​: OUTPUT«Potential difficulties​:␤ Useless
redeclaration of variable $a [...] ok 00​:01 119m␤»
<masak> allowed, but if it's in the same block, you get a warning.
<jaffa4> rakudo fails for redeclaration
<masak> yes, it does.
<jaffa4> I fixed the example, is that ok?
<jaffa4> I have access to github perl6 repository
<jaffa4> read -write
<jaffa4> Is it ok if I commit that?
<masak> permission > forgiveness, so yes :)
<masak> jaffa4​: there might be some RT ticket that can be closed if
such a commit goes in, too.
* masak looks
<jaffa4> RT ticket?
<masak> yes, it's our issue tracker. http://rt.perl.org/rt3/
<masak> but I looked, and I don't see any ticket for that.
<jaffa4> I am not surprised
* masak submits one
<masak> that way, you'll get the satisfaction of having a resolved
ticket in RT :)
<masak> rakudo​: my $a; my $a; say 'alive'
<p6eval> rakudo 924242​: OUTPUT«===SORRY!===␤Redeclaration of symbol $a [...]

@p6rt
Copy link
Author

p6rt commented Mar 8, 2013

From @jnthn

On Sat Feb 05 03​:33​:17 2011, masak wrote​:

<jaffa4> Is redeclaration of a variable allowed in Perl 6?
<masak> std​: my $a; my $a
<p6eval> std 625303c​: OUTPUT«Potential difficulties​:␤ Useless
redeclaration of variable $a [...] ok 00​:01 119m␤»
<masak> allowed, but if it's in the same block, you get a warning.
<jaffa4> rakudo fails for redeclaration
<masak> yes, it does.
<jaffa4> I fixed the example, is that ok?
<jaffa4> I have access to github perl6 repository
<jaffa4> read -write
<jaffa4> Is it ok if I commit that?
<masak> permission > forgiveness, so yes :)
<masak> jaffa4​: there might be some RT ticket that can be closed if
such a commit goes in, too.
* masak looks
<jaffa4> RT ticket?
<masak> yes, it's our issue tracker. http://rt.perl.org/rt3/
<masak> but I looked, and I don't see any ticket for that.
<jaffa4> I am not surprised
* masak submits one
<masak> that way, you'll get the satisfaction of having a resolved
ticket in RT :)
<masak> rakudo​: my $a; my $a; say 'alive'
<p6eval> rakudo 924242​: OUTPUT«===SORRY!===␤Redeclaration of symbol
$a [...]

It's just a warning now​:

my $a; my $a; say "still alive"
Potential difficulties​:
  Redeclaration of symbol $a
  at <unknown file>​:1
  ------> my $a; my $a<HERE>; say "still alive"
still alive

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Mar 8, 2013

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

@p6rt
Copy link
Author

p6rt commented Oct 1, 2014

From @usev6

There already was the following test in S04-declarations/multiple.t​:

eval_lives_ok 'my $x; my $x',
  'it is legal to declare my $x twice in the same scope.';

I added the ticket number to the test. If there should be a better test, please reopen the ticket.

1 similar comment
@p6rt
Copy link
Author

p6rt commented Oct 1, 2014

From @usev6

There already was the following test in S04-declarations/multiple.t​:

eval_lives_ok 'my $x; my $x',
  'it is legal to declare my $x twice in the same scope.';

I added the ticket number to the test. If there should be a better test, please reopen the ticket.

@p6rt p6rt closed this as completed Oct 1, 2014
@p6rt
Copy link
Author

p6rt commented Oct 1, 2014

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

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