From: Charles Oliver Nutter Date: 2008-11-18T14:35:50+09:00 Subject: Re: [][100000000] = 1 whee! Mike Austin wrote: > Charles Oliver Nutter wrote: >> Mike Austin wrote: >>> :) Just curious as to why Ruby automatically increases an array's >>> size when items are added. I could see where it would be convenient, >>> but it also seems like bad practice. One can, and should use a hash >>> as a sparse array. >> >> Because it's an array, not a sparse array. >> >> - Charlie >> > > True enough :) But what about in terms of practicality? Does it make > working with arrays that much simpler? I use Ruby Arrays as stacks > mostly, where you don't run into setting values outside the current range. No, it probably doesn't do a lot for arrays in general, but I suppose it does allow you to use an array as an N-wide list without immediately allocating the full backing store. That probably has some value. - Charlie