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


<masak> m: my %h1; %h1<foo> = 1; my %h2 = %h1; %h2<bar> = 2; say %h1
<camelia> rakudo-moar 42fb81: OUTPUT«foo => 1␤»
<masak> m: my %h1; %h1<foo> = 1; my %h2 := %h1.clone; %h2<bar> = 2; say %h1
<camelia> rakudo-moar 42fb81: OUTPUT«bar => 2, foo => 1␤»
* masak submits rakudobug
<masak> pretty sure this one is a regression. 007 has had code based
on Hash.clone for a long while to indicate "and now we enter a new
scope"
<masak> the bug manifests in the fact that old variables don't go away
when we leave a scope
<moritz> m: my %h1; %h1<foo> = 1; my %h2 = %h1.clone; %h2<bar> = 2; say %h1
<camelia> rakudo-moar 42fb81: OUTPUT«foo => 1␤»
<moritz> masak: I see
<moritz> the fact that one often uses hash assignment (which copies)
seems to shadow this bug from every day observation
<masak> moritz: reason I didn't simply use hash assignment is that in
my case, the hash was in an array.
<moritz> star-m: my %h1; %h1<foo> = 1; my %h2 := %h1.clone; %h2<bar> =
2; say %h1
<camelia> star-m 2016.01: OUTPUT«bar => 2, foo => 1␤»
* moritz wonders if a simple method clone in class Hash or Map helps
<moritz> m: say Hash.^mro
<camelia> rakudo-moar 42fb81: OUTPUT«((Hash) (Map) (Cool) (Any) (Mu))␤»

Reply via email to