Logan Capaldo wrote:
> On 7/4/07, Farhad Farzaneh <ff / onebeat.com> wrote:
>> => ["this"]
>> Posted via http://www.ruby-forum.com/.
>>
>>
> Copying is an interesting thing. For many objects there is a sane, 
> obvious
> way to make a copy. But for many others it is not so clear. Consider for
> instance, Hash.new($stdin). What should it mean, in this context, to 
> "copy"
> $stdin? Or consider Hash.new(some_very_large_object). Do you want a copy 
> all
> the time? Luckily, Hash does have a mechanism to acheive what you want:
> 
>>> x = Hash.new { |h,k| h[k] = [] }
> => {}
>>> x[:test]
> => []
>>> x[:test] << 'this'
> => ["this"]
>>> x[:bar]
> => []
> 
> POLS also is matz.'s POLS.

Current behavior does (of course) make sense, and my confusion was due 
to my misunderstanding of the feature and its intended use.

Thanks to all.



-- 
Posted via http://www.ruby-forum.com/.