From: "trans. (T. Onoma)" Date: 2004-10-09T01:41:28+09:00 Subject: Re: Range behavior (Re: [RCR] New [] Semantics) On Friday 08 October 2004 09:43 am, trans. (T. Onoma) wrote: | Okay, planB is good. You are going the other way toward Range being | continuous. That's fine, but really that should be called an Interval: | | http://mathworld.wolfram.com/Interval.html | | Range really means something else. Following this to logical conclusion. (IMHO) Elegant design would be along these lines: class Interval # not Enumerable def to_rng Range[self] end def each # coerce to Range, then each to_rng.each end end (0..5).class #=> Interval class Range < Interval alias :enclose? :include? include Enumerable def self.[](*args) if args[0].kind_of?(Range) # ... end def initialize(start, length) # ... end def each # based on start#succ end end So a Range is a "temporal" Array, in contrast to an Array which is "spacal" --if you know what I mean. Also, coercing Interval to Range in #each deals with most, if not all, compatibility issues (I think). The only thing the above appears to need is how to handle the disconnect between Interval#end and Range#length. There's no perfect "congruence", as we have already discussed, but it shouldn't be difficult to determine this, i.e. I see no reason Range can't also support termination proc. T.