Aleksi Niemel<aleksi.niemela / cinnober.com> writes:

> > I seems to me that we could actually do it Perl's way (but better ;-)
> > with not too much each effort.
> 
> How about Arrays? Should they be automatically resized (enlarged)
> when one says:
> 
>   a = Array.new(2, 42, CREATENEWBYDEFAULT) 
>        #=> a = [42, 42]
>   puts a[4]            
>        #=> a = [42,42,42,42,42]

Logically not. The array semantics are different than hash. With
array, you explicitly say in the constructor that you want 'n' copies
of some object 'default'. The CreateNew flag here would not change the 
number of copies. Instead, it would affect whether those _were_
copies, or whether they were new objects.

As a totally separate change, you might want to argue for something
like:

  a = Array.new(0, 42)

meaning that reference to an unset array element returned 42. This
would give you the behavior above.


Regards


Dave