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 allows reference to variables before their declaration #535

Closed
p6rt opened this issue Dec 30, 2008 · 12 comments
Closed

Rakudo allows reference to variables before their declaration #535

p6rt opened this issue Dec 30, 2008 · 12 comments

Comments

@p6rt
Copy link

p6rt commented Dec 30, 2008

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

Searchable as RT61838$

@p6rt
Copy link
Author

p6rt commented Dec 30, 2008

From @masak

Rakudo r34628​:

$ perl6 -e 'my $a = $b'
Scope not found for PAST​::Var '$b'
[...]

$ perl6 -e 'my $a = $b; my $b' # Compiles and runs!

@p6rt
Copy link
Author

p6rt commented Jan 5, 2009

From @moritz

Carl MXXsak (via RT) wrote​:

# New Ticket Created by "Carl Mäsak"
# Please include the string​: [perl #​61838]
# in the subject line of all future correspondence about this issue.
# <URL​: http://rt.perl.org/rt3/Ticket/Display.html?id=61838 >

Rakudo r34628​:

$ perl6 -e 'my $a = $b'
Scope not found for PAST​::Var '$b'
[...]

$ perl6 -e 'my $a = $b; my $b' # Compiles and runs!

This is actually the first test in t/spec/S04-declarations/my.t (or
sufficiently similar).

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jan 5, 2009

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

@p6rt
Copy link
Author

p6rt commented Mar 11, 2009

From @masak

<masak> rakudo​: my @​a = $b; my $b = 5
<p6eval> rakudo 0c893b​: OUTPUT«Null PMC access in isa() [...]
* masak submits rakudobug

@p6rt
Copy link
Author

p6rt commented Mar 19, 2009

From @moritz

00​:49 < p6eval> rakudo c26021​: OUTPUT«Null PMC access in isa()␤current
instr.​: 'parrot;List;!flatten' pc 6213 (src/classes/List.pir​:253)␤»
00​:50 < moritz_> now that should complain at compile time about $x not
being declared

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Mar 20, 2009

From @masak

On Thu Mar 19 16​:56​:41 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

00​:49 < p6eval> rakudo c26021​: OUTPUT«Null PMC access in isa()␤current
instr.​: 'parrot;List;!flatten' pc 6213 (src/classes/List.pir​:253)␤»
00​:50 < moritz_> now that should complain at compile time about $x not
being declared

Wait, where's the code?

@p6rt
Copy link
Author

p6rt commented Mar 20, 2009

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

@p6rt
Copy link
Author

p6rt commented Mar 20, 2009

From @moritz

Carl Mäsak via RT wrote​:

On Thu Mar 19 16​:56​:41 2009, mlenz@​physik.uni-wuerzburg.de wrote​:

00​:49 < p6eval> rakudo c26021​: OUTPUT«Null PMC access in isa()␤current
instr.​: 'parrot;List;!flatten' pc 6213 (src/classes/List.pir​:253)␤»
00​:50 < moritz_> now that should complain at compile time about $x not
being declared

Wait, where's the code?

I shouldn't submit tickets late at night...

rakudo​: say $x; my $x=4
rakudo c26021​: OUTPUT«Null PMC access in isa()␤current instr.​:
'parrot;List;!flatten' pc 6213 (src/classes/List.pir​:253)␤»

There you go.

(I think we have tests for that in t/spec/S04-declarations/my.t, but I'm
too lazy to check right now)

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented Jun 27, 2010

From radu_cs85@yahoo.com

The following code outputs <Any()> instead of giving <symbol not predeclared> error​:

say $a;
my $a = 5;

<radu_> rakudo​: sub foo() {say $test; }; my $test = foo();
<p6eval> rakudo 233401​: OUTPUT«Any()␤»
<radu_> hm. I was expecting an undeclared variable error. Does anyone know if this is how it should work?
<allbery_b> I think it's like perl5​: the former is in the global setting, the latter in the lexical.  It *should* warn, though.
<pmichaud> that should've been an error, yes.
<pmichaud> rakudo​:  say $a;  my $a = 5;
<p6eval> rakudo 233401​: OUTPUT«Any()␤»
<pmichaud> that's.... weird.

 

@p6rt
Copy link
Author

p6rt commented Oct 6, 2010

From @masak

<Util> rakudo​: sub foo ( ) { say 2*$lexical }; my $lexical = 4; foo();
<p6eval> rakudo 2ee5db​: OUTPUT«8␤»
<Util> Why did that not err with "Symbol '$lexical' not predeclared in
foo"? Known bug?
<masak> Util​: hm. maybe.
<masak> I'll check.
<PerlJam> rakudo​: { say $a; my $a = 42; }
<p6eval> rakudo 2ee5db​: OUTPUT«Any()␤»
<masak> :(
<masak> rakudo​: say $a; my $a = 42
<p6eval> rakudo 2ee5db​: OUTPUT«Any()␤»
<masak> at least there's an old possibly closed ticket for that.
<Util> It is like any var that exists in a scope is legal from the
start of scope, instead of from the point of declaration. I am
suprised there is no spectest for that.
<masak> I can't find a ticket for it either.
<masak> I'm almost sure we had one.
<PerlJam> masak​: me too, I remember we talked about a similar (the
same) bug a long time ago
* masak submits rakudobug
<masak> Util++
<sorear> Util​: it's a pretty deep-seated bug in PAST
<masak> someone else might have better luck than I finding it in RT.
<masak> I found quite a number of similar ones, but not exactly that one.
<Util> Thanks, everyone

I found these tickets which are similar but not the same​:
  http://rt.perl.org/rt3/Ticket/Display.html?id=72948
  http://rt.perl.org/rt3/Ticket/Display.html?id=73074

@p6rt
Copy link
Author

p6rt commented Nov 2, 2011

From @moritz

Now fixed in rakudo commit d307831, unfudged test in
S04-declarations/my.t passes.

@p6rt
Copy link
Author

p6rt commented Nov 2, 2011

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

@p6rt p6rt closed this as completed Nov 2, 2011
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