From: Austin Ziegler Date: 2002-12-24T23:42:06+09:00 Subject: Re: Hash#update On Tue, 24 Dec 2002 11:47:36 +0900, Yukihiro Matsumoto wrote: > In message "Re: Hash#update" on 02/12/23, Austin Ziegler > writes: >|> No information lost by String#+ or Array#+, but Hash#update may >|> lose the value. That's why I rejected the name "+". It is >|> possible to provide the non destructive "update" under different >|> name. Good name? >| Hash#union, also Hash#| (not Hash#^). > Is it OK for you to lose values by the "union" method? Not for me. Actually, it is. Union -- as in a set union -- only keeps one instance of the key. In this instance, I would expect that: h1 = { 1 => 2, 2 => 3, 3 => 4 } h2 = { 1 => 5, 4 => 6, 3 => 7 } h3 = h1 | h2 # { 1 => 5, 2 => 3, 3 => 7, 4 => 6 } h4 = h2 | h1 # { 1 => 2, 2 => 3, 3 => 4, 4 => 6 } I would definitely NOT expect loss of values in "+" or "union all" (to use the SQL term). -austin -- Austin Ziegler, austin@halostatue.ca on 2002.12.24 at 09.40.12