David Green wrote:
For certain discrete ordered types, like Int, both ways work out the same, and since Ints are the most common and most obvious use for Ranges, it's easy to overlook the confusion. The case with strings is a good example: it really doesn't make sense that a value not produced by a range nevertheless lies between its endpoints. Why not have a separate Interval type?

I see no problem when a Range matches for values which are not produced
by a RangeIterator. I expect 2.5 ~~ 1..5 to be true even though 2.5 is
not in 1,2,3,4,5. The same applies for 'aaa' ~~ 'aa'..'az'. I find this
quite natural. Note that order is not a prerequisite for a notion of
range and range iteration. I think of ranges more like set and set
iteration. I'm going to post my take on the complex case elsewhere in
this thread.

Regards, TSa.
"The unavoidable price of reliability is simplicity" -- C.A.R. Hoare
"Simplicity does not precede complexity, but follows it." -- A.J. Perlis
1 + 2 + 3 + 4 + ... = -1/12  -- Srinivasa Ramanujan

Reply via email to