From: Brian Candler Date: 2004-10-06T18:15:53+09:00 Subject: Re: Range behavior (Re: [RCR] New [] Semantics) On Wed, Oct 06, 2004 at 11:18:50AM +0900, trans. (T. Onoma) wrote: > > Range serves as both continuous and discrete interval of values. > > 'member?' treat it as discrete, whereas 'include?' treat it as > > continuous. > > irb(main):001:0> a = 0..2 > => 0..2 > irb(main):002:0> a.include?(1) > => true > irb(main):003:0> a.include?(1.5) > => true > irb(main):004:0> a = a.to_a > => [0, 1, 2] > irb(main):005:0> a.include?(1) > => true > irb(main):006:0> a.include?(1.5) > => false > > :( Are you saying: get rid of Array#include? and Enumerable#include? (for 2.0)? If so I would agree. Or at least, very clearly document Enumerable#include? and Enumerable#member? as being intended for different purposes, whereas right now they are documented as being aliases, implying they are always interchangeable. This would give a duck-typing convention of #member?(x) -- x is an instance of a discrete set of values #include?(x) -- x is contained within a continuous interval Regards, Brian.