----- Original Message ----- From: Stefan Matthias Aust <sma / 3plus4.de> To: ruby-talk ML <ruby-talk / ruby-lang.org>; <ruby-talk / netlab.co.jp> Sent: Tuesday, May 29, 2001 3:41 PM Subject: [ruby-talk:15971] Re: Experimental "in" operator for collections > "Hal E. Fulton" <hal9000 / hypermetrics.com> wrote: > > >I've been in favor of an "in" operator for awhile... > >although better minds than mine are hesitant about it. > > Why? > Just because changes to the core language should be done with caution. It involves an actual parser change (as you know), not just an additional method in a class or something. > 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. Natural in English... but very unmathematical, and inconsistent with all other operators in Ruby. We can't say "x not == 5" (yes, we can say x != 5, but != is an operator in itself). I think "not" should be applied to an expression ("not some_expr"). "in [1,2,3]" is not an expression. It makes "not in" into an operator on its own. I won't fight it with my life; if it made its way into the syntax, I just wouldn't use it. Hal