Hi,

In message "[ruby-talk:04251] Re: TABWTDI and Hash.new([])"
    on 00/07/28, Dave Thomas <Dave / thomases.com> writes:

|In these circumstances, Hugh would like a new default value to be
|created. So, Matz, how about the following:
|
|1. Hash.new takes a second parameter:
|
|    Hash.new(default,  genNewDefaults=false)
|
|2. Whenever you currently return hash->ifnone, instead have
|
|      default = hash->ifnone
|
|      return default unless genNewDefaults
|
|      if default.kind_of? Class
|           return default.new
|      else
|           return default.dup
|      end

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.

							matz.