From: ts Date: 2003-03-24T02:24:54+09:00 Subject: Re: Question about behavior of Array.new >>>>> "J" == Jeremy writes: J> I found out at this point, and with a bit of searching in the ruby.lang J> archives, that this winds up creating an array with nine references to the J> same object. So, now knowing that this happens, I can deal with it, but J> what I want to know is WHY it's like this. How do you create these 9 objects from one object ? and don't reply #dup because in some special case it can be inappropriated :-) 1.8 has a new syntax where Array::new accept a block to do what you want pigeon% ruby -ve 'p Array.new(2) { Object.new }' ruby 1.8.0 (2003-03-23) [i686-linux] [#, #] pigeon% *warning* it don't work with 1.6.8 pigeon% /usr/bin/ruby -ve 'p Array.new(2) { Object.new }' ruby 1.6.8 (2002-12-24) [i686-linux] [nil, nil] pigeon% Guy Decoux