From: Stefan Matthias Aust Date: 2001-05-30T07:41:28+09:00 Subject: [ruby-talk:15971] Re: Experimental "in" operator for collections "Hal E. Fulton" wrote: >I've been in favor of an "in" operator for awhile... >although better minds than mine are hesitant about it. Why? >Actually, the way I would do it is not to assume that it's an array. I would >say, let it be any object that responds to the include? message. Array was just an example. It works nicely with all kinds of objects - as long as they implement "includes?". >> object not in array > >This I disagree with. There's no other operator in Ruby that lets you >interpose a "not" in such a way. I'd much rather do it the >traditional way: > > not object in array well, they way I hacked the system, "not object in array" is a parsing error, but you could use "! object in array". I always thought that "!" and "not" are treaten the same, but probably one of the context sensitive "hacks" in parse.y gets into the way. IMHO, "1 not in [1,2,3] is the most natural form. bye -- Stefan Matthias Aust \/ Truth Until Paradox