From: "Aleksi Niemelä" Date: 2001-01-09T17:47:28+09:00 Subject: [ruby-talk:8908] Re: bug?? matz said: > I think `default' and `key_missing' are to fix similar things, but > somewhat different. They are corresponding to fetch(key,default) and > fetch(key){...} respectively. > > Hash fall back by method > > I think > > Hash.new{...} > > is the way to go. I agree. But should we have way to change the hash default initializer? class Hash def default=(&block) @default_initializer = block end end (Except that I couldn't make the call succeed in any of these ways hash.default= { "foo" } hash.default=() { "foo" } hash.default= do "foo" end hash.default=() do "foo" end but I guess my idea is clear anyway...) - Aleksi