From: Brian Candler Date: 2004-10-10T03:34:54+09:00 Subject: Re: Range behavior (Re: [RCR] New [] Semantics) On Sun, Oct 10, 2004 at 02:30:51AM +0900, trans. (T. Onoma) wrote: > On Saturday 09 October 2004 01:14 pm, James Edward Gray II wrote: > | On Oct 9, 2004, at 7:07 AM, Brian Candler wrote: > | > I agree with Matz - Range#member? is not very useful. For the > | > occasional > | > case where you might need such semantics, it's easy enough to code up > | > your > | > own object which behaves how you want. > | > | Or just use: > | > | (3..5).to_a.include?(4) > > Note that this won't work for > > Inf = 1.0/0 > (3..Inf).to_a.include?(5) But that's unlikely to be useful anyway, even with the current member? syntax, since it either returns true or hangs in an infinite loop: (3..Inf).member?(1) [Actually Ruby hangs in an infinite loop even if the value is found, but Matz has acknowledged that as a bug] Regards, Brian.