From: Joel VanderWerf Date: 2002-12-19T05:16:53+09:00 Subject: Re: Hash.new{...} bug? Bulat Ziganshin wrote: > Hello nobu, > > Wednesday, December 18, 2002, 4:47:39 PM, you wrote: > > >>>hash = Hash.new{Hash.new} > > nnsn> Hash 'default' proc never modify the hash itself automatically. > nnsn> Try with this. > > nnsn> hash = Hash.new {|h,k| h[k] = Hash.new} > > thanks. but with Hash.new(...) hash element updated to default value. > is this difference intended? What difference to you mean? h1 = Hash.new(7) h2 = Hash.new{7} p h1[3] p h2[3] p h1 p h2 Output: 7 7 {} {}