From: matz@... (Yukihiro Matsumoto) Date: 2000-08-08T00:36:26+09:00 Subject: [ruby-talk:04332] Re: TABWTDI and Hash.new([]) Hi, In message "[ruby-talk:04327] Re: TABWTDI and Hash.new([])" on 00/08/07, Hugh Sasse Staff Elec Eng writes: |> > 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. By the way, hash.fetch(key){[]} may be sufficient for the purpose. This is available in 1.5 without any modification. |I agree with those sentiments as well. I wonder if this would be worth |extending more gnerally, so user-created classes can use it? I'm not sure I understand what you mean. Could you explain a bit more? matz.