From: Tom Sawyer Date: 2003-02-03T22:30:00+09:00 Subject: Re: Hash#+ ? On Monday 03 February 2003 06:06 am, Akinori MUSHA wrote: > At Mon, 3 Feb 2003 21:31:53 +0900, > > Tom Sawyer wrote: > We have live examples that show that Array#+ is useful. Try grepping > the source tree for /\+=? *[/. Another reason for Array#+ is that > arrays are stackable and a + operator matches our expectation and an > analogy to String#+. well, that's kind of unfair in that i can't do the same grep on Hash#|. if it existed then it would be different story. although i'm sure Array#+ would get used more. i don't dispute that. also i'm not in favor of Hash#+ for the reasons you state. i believe it shoud be Hash#| since duplicates are overwirtten, which is more in line with with Array#| where duplicates are removed. > My question is: would it be so a popular demand to add a new method > for Hash? We have been living without it and a.dup.update(b) or > {}.update(a).update(b) will do the job if you need the functionality. > I'm not really against the idea, but just curious as to how it is > going to be used. the utility that i've come across is when i want to keep my original hash but also make a new one with addional elements. guess that's obvious. like i said, i will give real examples as they come up. (there's a couple in the app i'm working on, but it is a huge cgi app, and i don't recall off hand where they were.) but i'll let you know. -- tom sawyer, aka transami transami@transami.net