On Sun Sep 19 06:33:09 2010, masak wrote: > <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}»
Fixed: 16:13 < [Coke]> rakudo: my $x = Hash.new(a => 1); $x<a> = 2; say $x.perl 16:13 <+p6eval> rakudo 88c5a5: OUTPUT«{"a" => 2}» Closable with tests. -- Will "Coke" Coleda