From: Ron Fox Date: 2008-11-18T22:16:27+09:00 Subject: Re: [][100000000] = 1 whee! I use arrays for other purposes... however the best answer is probably to think of Ruby, or any other programming language for that matter, as a game with a fixed set of rules. You have to play by those rules... or play another game. That leads to the answer that Ruby does this because the designer chose to do it that way. No other reason needed. Ron 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. > > ~ Mike -- Ron Fox NSCL Michigan State University East Lansing, MI 48824-1321