From: Trans Date: 2007-01-09T10:46:20+09:00 Subject: Re: a most undangerous Hash#store! Mauricio Fernandez wrote: > Anyway, Trans was talking about destructive updates, so what about > > def store?(key, value) > unless key?(key) > store(key,value) > return true > end > false > end > > similar to the #store! he described, but with a more regular behavior when you > have nil/false values... well, i was thinking of combining Mr. Haines idea with Mr. James to get #store_new, which seemed just about right. but now your suggestion is quite interesting. at first i wasn't so sure, but thinking about it a little more it makes sense -- "is something stored with this key? if not store this value with it". i was also worried that it did not return the stored value like the normal store, but i realize now that could be ambigious if value=nil, so you may be on point. is that right? if so then i have to go with your suggestion. t.