On Sunday 10 October 2004 06:23 am, Brian Candler wrote:
| Or drop Enumerable from Range, and give it a handful of duck-type methods:
|  each
|  to_a
|  map / collect
|  (min)
|  (max)
|
| plus its own non-enumerable 'include?' of course.
|
| Mixing in the real Enumerable saves a little bit of coding, but like you
| say, it adds a lot of methods which have little or no value and perhaps
| that's what's confusing.
|
| However I don't really object to a Range being Enumerable in the full
| sense, even if some of the methods don't make sense; I think it's important
| to distinguish Range#include? / member? from Enumberable#include? / member?

Fully concur. This is essentially the conclusion I arrived at too. It is 
confusing from the start: (0..4).kind_of?(Enumerable) can't answer 
"sort-of" ;)  Fact is, as matz pointed out, Range doesn't even need a 
#member? method.  Dump Enumerable and add the methods you mention above (plus 
#include?).

BTW: I agree #begin and #end are not good method names.

T.