From: Mark Wilson Date: 2003-05-26T06:26:42+09:00 Subject: Re: Range#size, Range#length On Sunday, May 25, 2003, at 04:53 PM, Hal E. Fulton wrote: > Apparently size and length are missing from > the Range class nowadays. > > This surprises me a little. Is it because of > Float ranges or something? > > I've made do with range.entries.size, which > works fine. > > What's the rationale here? I'm curious. > > [snip] There was a lengthy discussion on the list about this a few months ago. The size of float ranges was one issue. Here's a length to one thread: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF- 8&threadm=Pine.LNX.4.33.0302121350410.3138- 100000%40eli.fsl.noaa.gov&rnum=1&prev=/ groups%3Fq%3Druby%2Brange%2Blength%2Bsize%26hl%3Den%26lr%3D%26ie%3DUTF- 8%26oe%3DUTF-8%26sa%3DN%26tab%3Dwg I think the decision comes down to saying that if you are using ranges as a form of constructor for an array, you should think of your range object in those terms -- i.e., explicitly call an iterator to count the number of entries. The more I think about it, range is an unusual thing (very useful, memory efficient, but odd among Ruby objects in that it is really a function).