On Wed, Mar 26, 2008 at 7:01 PM, Dave Thomas <dave / pragprog.com> wrote:
>  So, in the general case, all ranges are discrete.
>
>  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.
>
>  So, yes, I think that all range membership tests should be discrete,
>  with float being the special case that you fake it out because
>  iterating over the infinite number of values would take too long :)

Oh, btw, not only floats but also Rationals (and maybe some other
custom Numeric types).

And such changes would invalidate the "The Ruby programming language"
book, section "Ranges":

" If the endpoints of the range are numbers, these methods use the
continuous membership test, just as they did in Ruby 1.8. If the
endpoints are not numeric, however, they instead use the discrete
membership test. "

Thanks,
  --Vladimir