From: "trans. (T. Onoma)" Date: 2004-10-10T04:52:54+09:00 Subject: Re: Range behavior (Re: [RCR] New [] Semantics) On Saturday 09 October 2004 03:25 pm, trans. (T. Onoma) wrote: | Note: Consider a special EvenInt class with a succ of: {|x| x+2}, make a | Range of those and use it as an Array index argument, | |    arr = [1,2,3,4,5,6,7,8] |    arr[EvenInt.new(2)..EvenInt.new(4)] | | would you expect [2,3,6,8]? I haven't tried it but my bet is you'll get | [2,3,4,5,6,7,8] instead. In fact, I just played with this idea a bit and found Range to be quite out of wack: class Fixnum def succ self + 2 end end r = 2..14 => 2..14 r.to_a => [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] r.each {|e| print "#{e} "}; puts 2 3 4 5 6 7 8 9 10 11 12 13 14 => nil r.member?(4) => true r.member?(3) false Unless I goofed somehow, this is even more evidence that Enumerable is of little use in Range. From the looks of it I'm don't think #succ is even being used for anything besides the #member? method!!! I assume this is because it is trying to optimize for Fixnum. T.