[BUG] Re: [ruby-cvs:31600] Ruby:r24382 (trunk): * hash.c (rb_hash_replace): should copy compare_by_i

Yuguie$B$G$9!#e(B

On 8/4/09 7:44 AM, [email protected] wrote:

* hash.c (rb_hash_replace): should copy compare_by_identity status as well.
  [ruby-core:24728]

e$B85$Ne(B[ruby-core:24728]e$B$N!"e(Bdup,
clonee$B$Ge(Bcompare_by_identitye$B$,%3%T!<$5$l$J$$e(B
e$B$H$$$&LdBj$O$3$l$GD>$j$^$7$?!#e(B

e$B$?$@!"$3$l$G$9$He(BHash#replacee$B$7$?>l9g$^$G%3%T!<$5$l$F$7$^$$$^$9$h$Me(B?
Hash#replacee$B$Oe(B

Replaces the contents of hsh with
e$B$H=q$$$F$"$k$/$i$$$J$N$G!“FbMF$N$_$r0$7$Fe(Bcompare_by_identity’nesse$B$O0$ie(B
e$B$J$$$H$$$&2r<a$b$”$jF@$k$H;W$$$^$9!#e(B

e$B$I$A$i$bIT9,$K$J$k%1!<%9$,$"$k$H;W$$$^$9$,!"$I$A$i$N5sF0$,K>$^$7$$$G$7$ge(B
e$B$&$+!#e(B

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:39045] [BUG] Re: [ruby-cvs:31600] Ruby:r24382
(trunk): * hash.c (rb_hash_replace): should copy compare_by_identity
status as well.”
on Sat, 8 Aug 2009 22:03:00 +0900, “Yugui (Yuki S.)”
[email protected] writes:

|e$B85$Ne(B[ruby-core:24728]e$B$N!“e(Bdup, clonee$B$Ge(Bcompare_by_identitye$B$,%3%T!<$5$l$J$$e(B
|e$B$H$$$&LdBj$O$3$l$GD>$j$^$7$?!#e(B
|
|e$B$?$@!”$3$l$G$9$He(BHash#replacee$B$7$?>l9g$^$G%3%T!<$5$l$F$7$^$$$^$9$h$Me(B?
|Hash#replacee$B$Oe(B
|> Replaces the contents of hsh with
|e$B$H=q$$$F$“$k$/$i$$$J$N$G!“FbMF$N$_$r0$7$Fe(Bcompare_by_identity’nesse$B$O0$ie(B
|e$B$J$$$H$$$&2r<a$b$”$jF@$k$H;W$$$^$9!#e(B
|
|e$B$I$A$i$bIT9,$K$J$k%1!<%9$,$”$k$H;W$$$^$9$,!"$I$A$i$N5sF0$,K>$^$7$$$G$7$ge(B
|e$B$&$+!#e(B

e$B$“$^$jH/@8$7$J$$$H;W$&$N$G!”?4G[$7$F$b$7$+$?$,$J$$$h$&$J5$$be(B
e$B$7$J$$$G$b$J$$$N$G$9$,!“;EMM$H$7$F$ODj5A$9$kI,MW$,$”$k$G$7$ge(B
e$B$&$M!#e(B

e$B$G!";d$N9M$($r8@$($P!"e(BHashe$B$N%-!<$OHf3S$N>uBV$H$NAH$_9g$o$;$Ge(B
e$B$J$$$H0UL#$,$J$$$h$&$K;W$$$^$9!#$?$H$($P!"e(B

h = {}
h.compare_by_identity
h[“foo”] = “bar”
h[“foo”] = “baz”
p h # => {“foo”=>“bar”, “foo”=>“baz”}

e$B$H$J$k$o$1$G$9$,!"2>$Ke(Breplacee$B$,e(Bcompare_by_identitye$B>uBV$r%3%T!<e(B
e$B$7$J$$$H$9$k$He(B

h2 = {}
h2.replace(h)
p h2[“foo”] # => “bar”? “baz”? e$BM=B,:$Fqe(B

e$B$H$J$k$o$1$G$9!#$3$l$O$“$s$^$j$&$l$7$/$”$j$^$;$se(B(1.9e$B$@$+$iA^e(B
e$BF~=g$,Aa$$J}$,M%@h$J$s$G$9$,!“$$$D$bA^F~=g$,L@$i$+$H$O8B$j$^e(B
e$B$;$s$7e(B)e$B!#0lJ}!”%3%T!<$9$k$J$i$Pe(B

p h2 # => {“foo”=>“bar”, “foo”=>“baz”}

e$B$H$J$k$G$7$g$&!#e(Bh2[“foo”]e$B$N7k2L$OEvA3e(Bnile$B$G$9!#e(B

e$B$H$$$&$o$1$G!“8=>uDL$je(Bcompare_by_identitye$B@-$Oe(Breplacee$B$K$h$C$Fe(B
e$B%3%T!<$5$l$?J}$,$h$$!”$K0lI<$G$9!#e(B

                            e$B$^$D$b$He(B e$B$f$-$R$me(B /:|)