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


<Radvendii> is it *remotely* possible that given $i {} is changing the
value of $i?
<masak> nom: my $i = 5; given $i { $_ = 42 }; say $i
<p6eval> nom 9719f7: OUTPUT«42␤»
<Radvendii> that's not what i'm saying
<Radvendii> nom: my $i=5; $i.say; given $i { $i.say};
<p6eval> nom 9719f7: OUTPUT«5␤5␤»
<Radvendii> and those two are different in my program
<Radvendii> feel free to golf a short example of it.
<Radvendii> masak: i'll try...
<Radvendii> YAY
<Radvendii> masak: i distilled the error down
<Radvendii> nom: sub foo ($a, $f) { if $f { foo('z', 0) }; given $a
{say $a; say $_} }; foo('x', 1)
<p6eval> nom 9719f7: OUTPUT«z␤z␤z␤x␤»
<masak> Radvendii++
<masak> that is the real deal.
* masak submits rakudobug
<Radvendii> masak: yay :D
<moritz> perl6: sub foo ($a, $f) { if $f { foo('z', 0) }; given $a
{say $a; say $_} }; foo('x', 1)
<p6eval> rakudo 9719f7: OUTPUT«z␤z␤z␤x␤»
<p6eval> ..pugs b927740, niecza v13-381-g4158fa9: OUTPUT«z␤z␤x␤x␤»
 * masak is surprised we still have this kind of lexpad bug
* Radvendii assumes lexpad has to do with lexical scopes?
<moritz> yes
<Radvendii> cool
<masak> Radvendii: if I had to guess, what you're seeing is the given
block anchoring to the lexpad of the first invocation, and then when
the lookup for $a is done in the second invocation, it finds the wrong
-- the old -- OUTER for the given block.
<masak> at least that's a hypothesis consistent with the data.

Reply via email to