From: matz@... (Yukihiro Matsumoto) Date: 2000-10-31T08:05:39+09:00 Subject: [ruby-talk:5956] Re: Hash.new {block} / Hash#default_proc{,_set} Hi, In message "[ruby-talk:5947] Hash.new {block} / Hash#default_proc{,_set}" on 00/10/31, "Brian F. Feldman" writes: |I've done very little testing, but I think I've successfully implemented the |ability for a Hash to provide a default procedure rather than variable. | |The only reasonable way I could think of doing this required on-the-fly |creation of a hash entry when a lookup fails -- otherwise, this feature is |nearly useless (does not make anything easier). | |Here's the diff, my 3rd time modifying Ruby code itself. Comments? Three points: * currently each internal structure sizes are made strictly less than 5 pointer size for space efficiency. * your on-the-fly entry creation idea sound reasonable; but I think we need to discuss it before merging it. * we need to inspect cost/benefit between this patch and Hash#fetch which already takes a block to give a value for non existing entry. Thank you anyway. matz.