From: Dave Thomas Date: 2008-03-27T05:29:21+09:00 Subject: Re: Recent changes in Range#step behavior Gabon: You'd still have t3.between? t1, t2 And you'd still have t1..t2.cover t3 So it seems you're covered Cheers Dave On Mar 26, 2008, at 3:02 PM, "Gavin Kistner" wrote: > From: Dave Thomas [mailto:dave@pragprog.com] >> The anomaly is ranges of floats, which you aren't allowed to iterate >> anyway. In that case, member? becomes a comparison that the argument >> is between the limit, because conceptually the range (1.0..2.0) >> contains the infinite number of real values between 1 and 2. > > I've occasionally found it convenient to use a single Range of Time > values, to be able to determine if a time falls in the middle of > them. A > range of Times would not, I think, be considered discrete. > > I would be sad (and confused) if this behavior changed: > > irb(main):006:0> t1 = Time.now > => Wed Mar 26 13:59:15 -0600 2008 > irb(main):007:0> t2 = t1 + 10 > => Wed Mar 26 13:59:25 -0600 2008 > irb(main):008:0> t3 = t1 + 5.5 > => Wed Mar 26 13:59:21 -0600 2008 > irb(main):009:0> (t1..t2).include?( t3 ) > => true > > ...despite the fact that Time#succ is defined and happens to step > forward 1 second at a time. > > I ask for validating arguments to the claim that a range is a set of > discrete elements. I contend that it is only discrete once it is > actually expanded/iterated. It seems more appropriate to have > my_range.to_set.include?( foo ) when you truly want to talk about set > membership. >