From: Christoph Date: 2002-04-30T19:45:17+09:00 Subject: Re: Numberic#prev "Yukihiro Matsumoto" wrote in .... > Hi, > > In message "Re: Numberic#prev" > on 02/04/28, "Christoph" writes: > > |On the other hand what is useful about > > I'm not really sure what you meant. I guess my point was that forming Ranges from non-Integer Numeric arguments is (in my mind;-) a bit like declaring class Numeric def prev to_i - 1 end def succ to_i + 1 end end - both construction might be occasionally useful but they don't seem to be useful enough (imho;-) to elevate them to standard behavior. > > | (2.2..4.3) == (2..4) # => false > | (2.2...4.3) == (2...4) # => false > | (2.2..4.3).to_a # => [2,3,4] > | (2.2...4.3).to_a # => [2,3]. > > Even if they produce same integer arrays by "to_a", it does not mean > they are same. True - however --- (2.2..4.3).to_a.member? 2 # => true # but (2.2..4.3).member? 2 # => false require 'complex' (2..Complex(-4)).member? 3 # => true --- All in all: The way Range and Numeric classes interact is plainly counter intuitive too me. /Christoph