From: Hugh Sasse Staff Elec Eng Date: 2000-08-07T13:30:43+01:00 Subject: [ruby-talk:04327] Re: TABWTDI and Hash.new([]) On 28 Jul 2000, Dave Thomas wrote: Having been away for a week... > matz@netlab.co.jp (Yukihiro Matsumoto) writes: > > > I'm thinking of another way: > > > > Hash.new{[]} > > > > This means if the key is not found in the hash, evaluate given block > > and returns its value as default. In this example, the block creates > > new array for each execution. > > That's far more general - I like this a lot. > > I agree with those sentiments as well. I wonder if this would be worth extending more gnerally, so user-created classes can use it? Thank you, Hugh hgs@dmu.ac.uk