From: Daniel Carrera Date: 2003-01-23T11:20:44+09:00 Subject: Re: Hash#+ ? On Thu, Jan 23, 2003 at 11:14:08AM +0900, Tom Sawyer wrote: > On Wednesday 22 January 2003 06:52 pm, dblack@candle.superlink.net wrote: > > 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? > > David, what value can be lost? i don't understand. hash1 = { "key1" => "foo", "key2" => "bar" } hash2 = { "key1" => "baz", "key3" => "blah" } hash1 + hash2 # -> What is the value for "key1"? I like the idea of Hash#| or Hash#or. It is simply an 'or' function. Whichever comes first has precedence: hash1 | hash2 # -> "key1" => "foo" hash2 | hash1 # -> "key1" => "baz" -- Daniel Carrera Graduate Teaching Assistant. Math Dept. University of Maryland. (301) 405-5137