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


<masak> lue: re "the appearance of working", I think you found a bug. lue++
<masak> https://gist.github.com/4110132 -- surely this doesn't look right?

Gist inlined for your convenience:

$ nom
> my $a = 42;
42
> $a = 43
43
> my $a = 5
5
> $a
43
>

<masak> when the corresponding statements are put in a file, Rakudo
currently dies when parsing the third statement.
<masak> rn: my $a = 42; $a = 43; my $a = 5; say $a
<p6eval> niecza v22-33-gda13155: OUTPUT«Potential difficulties:␤
Useless redeclaration of variable $a [...]␤␤5␤»
<p6eval> ..rakudo cecc9f: OUTPUT«===SORRY!===␤Redeclaration of symbol
$a␤at /tmp/2LWYeAWef0:1␤»
<masak> Niecza has it right, IMO.
<jnthn> masak: We don't have any worry/panic distinction yet
<jnthn> masak: repl thing is fine
<jnthn> every line is a new scope
<jnthn> the utility of a repl is greatly reduced if you can't
redeclare things. We allow it just through lexical scoping.
<jnthn> so, working as designed
<jnthn> masak: oh, I see the issue...it somehwo gets the wrong value at the end
<jnthn> wtf
<masak> jnthn: right.
* masak submits rakudobug

Just to be clear: this bug is *not* about the worry/panic distinction
being a TODO in Rakudo. This bug is about the REPL ignoring the
assingment in a redeclaration.

Reply via email to