# New Ticket Created by "Carl Mäsak" # Please include the string: [perl #77922] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=77922 >
<Kodi> rakudo: my $x = Hash.new(a => 1); $x<a> = 2; say $x.perl <p6eval> rakudo ccde8d: OUTPUT«Cannot modify readonly value in '&infix:<=>' [...] * masak submits rakudobug <moritz_> this makes some perverted sense. <Kodi> The implementation of hash initialization does indeed look fishy. <Kodi> moritz_: What's your reasoning? <moritz_> Kodi: it binds $x<a> to 1 <moritz_> and since 1 is not a container, you can't assign to $x<a> subsequently <moritz_> rakudo: my $x = 4; my $h = Hash.new(:$x); $h<a> = 42; say $x <p6eval> rakudo ccde8d: OUTPUT«4» <moritz_> rakudo: my $a = 4; my $h = Hash.new(:$a); $h<a> = 42; say $a <p6eval> rakudo ccde8d: OUTPUT«42» <moritz_> mind you, I'm not saying it's right; I just said it made some perverted sense. <Kodi> Shouldn't Hash.new assign rather than bind, since hashes are supposed to be mutable? <Kodi> Oh. <jnthn> Yeah, perverted sense, but I'm quite sure it's rong. <masak> rakudo: my $x = Hash.new(a => 1); $x<b> = 2; say $x.perl <p6eval> rakudo ccde8d: OUTPUT«{"b" => 2, "a" => 1}»