From: Evan Phoenix Date: 2006-03-20T09:50:47+09:00 Subject: Re: [ ruby-Bugs-3843 ] "not" operator used in expression that is a method parameter can generate syntax error Huh. Correct you are. In addition, def won't accept && as a method name. I was thinking of &... At any rate, I guess it's just like have two different ands that have different presedence and therefore can be used in different places for different things (my previous example). - Evan On 3/19/06, Joel VanderWerf wrote: > Evan Phoenix wrote: > > > The same goes for your examples though. Now, I'd agree that at first, > > the fact that "and" is different from "&&" is a bit.. strange. But > > remember that it seems from the fact that "and" is a parser directive > > that creates an actual AND node in the AST. Where as, && is simply a > > binary operator, and thus a normal method call. > > Actually, it is "&" that can be defined as a method. You are free define > an "&&" method, but it will not be used as expected: > > irb(main):002:0> class Foo > irb(main):003:1> define_method "&&" do puts "HAHA"; end > irb(main):004:1> end > => # > irb(main):005:0> foo = Foo.new > => # > irb(main):006:0> foo && 123 > => 123 > irb(main):007:0> foo.send("&&", 123) > HAHA > => nil > > -- > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 > > -- When I do good, I feel good; when I do bad, I feel bad, and that is my religion. -- Abraham Lincoln (1809 - 1865)