From: Nikodemus Siivola Date: 2002-07-03T20:20:23+09:00 Subject: Re: (0..3) == (0...4) returning false? On Wed, 3 Jul 2002, Yukihiro Matsumoto wrote: > > Although (0...4) === 3.2 produces true (which means 3.2 is > > included in (0...4) ) 3.2 is no element of (0...4) in terms of > I'm working on it in 1.7, but still no firm decision. > If you have any comment, proposal, and idea, tell me freely. You want wishlists? I have wishlists :-) 1) Ranges as sets of numbers: Set.new(0...4) === 3.2 #-> false Set.new(0...4, 0.1) === 3.2 #-> true 2) Ranges as ranges of floats and integers: Range.new(0...4) === 3.2 #-> true So, the current behaviour is correct, since iteration over a floating range should default to a step of one, but I should definable at creation: Range.new(0...2, 0.5) === 1.3 #-> true Range.new(0...2, 0.5).to_ary == [0.0, 0.5, 1.0, 1.5, 2.0] So a range object would case-match against any number between the two extremes, but would be iterated over at a definable step and use the same step in array / set conversion. 3) A Set-class in the core. -- Nikodemus