You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<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))»
Migrated from rt.perl.org#127704 (status was 'resolved')
Searchable as RT127704$
The text was updated successfully, but these errors were encountered: