From: Yohanes Santoso Date: 2002-01-26T19:32:53+09:00 Subject: Re: Serious Array Bug in Ruby 1.6.6? > # BTW, haven't you heard about flyweight? Flyweight: the technique of using an object instance in multiple places. Commonly found in a system with large objects where many are similar to the others. While I can't find the validity of having Array.new(2,Hash.new) to produce an array with two distinct hashes, Array.new(i,Array.new(i,0.0)) is useful in working with diagonally symmetric matrix. I also do not want Array(100,5) to results in an array of 100 Integer objects. Since it seems Array(2,Hash.new) is an exception, rather than a frequent occurrence, the prudent thing to do is to do as Rippel suggested: make your own special constructor. However, if there is a significant interest in seeing a constructor to create distinct objects, then Array.initialize may be changed as follow: Array.initialize(elementCount=0, anObject=nil, distinct=false) which does not break existing implementation. If you want to make distinct Hash objects, then you can say: Array.new(2, :Hash, true), passing the symbol instead of objects. After all, in existing construct, Array(2, Hash.new) in my POLS should create the Hash object first before constructing the array. That's only logical. Changing that would break even simple constructs such as: a="Hello" a+=String.new(" world") a+=String.new(". We come "+String.new("in peace")) because according to your POLS, String.new("in peace") should not be evaluated prior to being used. YS.