From: Markus Date: 2004-10-08T00:27:57+09:00 Subject: Re: Range behavior (Re: [RCR] New [] Semantics) On Thu, 2004-10-07 at 07:11, trans. (T. Onoma) wrote: > --only Numeric ranges can be Continuous. Not so. Time ranges, for example, can be Continuous, as could Colour or FuzzyTruthValue or... > Consider further how succ determines successive members --a Range is an > indeterminate ordered set built by iteration. Oddly one defines a Range with > a first and last argument, but iterations are supposed to be defined by a > seed (first) and the number of successive iterations. Supposed by whom? You can just as easily define an iteration with a termination test (e.g. iterating over the lines of a File). > And there is good > reason for this: there is no way to be sure that any given _last_ is a member > of the set! Look at this: > > class ShrinkyDink > def initialize(x); @x = x.to_i; end > def succ; @x - 1; end > def <=>(b); @x <=> b; end > end > > rng = ShrinkyDink.new(0)...ShrinkyDink.new(100) > > Not only is ShrinkyDink.new(100) not a member of the range, but nothing > "inbetween" the two is either! This fails because the implementation of either succ or <=> is aberrant; by definition x.succ > x, while that is not the case for ShrinkyDinks. If you start going down that path (e.g. "but what if they write: def ShrinkyDink.to_s() `rm -f *` end "?) no answer will withstand scrutiny. -- Markus