On 27 Jul 2000, Dave Thomas wrote:

	[...] 
> Unlike Perl, Ruby doesn't automagically create the sub-arrays the
> first time you reference one. You could do it by subclassing Hash, or

The Ruby philosophy is that there is a better way to do things.
I expected Hash.new(thing) to give me a new thing for each undefined
key of the Hash.  So my question is: "Why is it better to have a 
single default object shared, than to create a copy of the defualt object
when an undefined key is referenced?"

Answers I can think of include:
1 It saves memory
2 In the case of nil it is irrelevant, because nil can only be nil
3 It ensueres the programmer creates new objects deliberately.

Counter arguments:
1 Only important for embedded systems
2 For most types of object this is not true.
3 This goes against the dynamic feel of ruby, and causes problems
  when method calls are made on the object returned by a key such as
  myhash[akey].push(something)

I can live with this now I know, so I am not really pressing for change,
but I'd like to know about the serious considerations that make this way
the better way.  It will help me understand the thinking behind ruby
better.

	Thank you
	Hugh
	hgs / dmu.ac.uk