From: Robert Dober Date: 2006-03-21T01:00:39+09:00 Subject: Re: [ ruby-Bugs-3843 ] "not" operator used in expression that is a method parameter can generate syntax error ------=_Part_3703_7847503.1142870422783 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Good thaughts and explanations, I really like to descend to that level of understanding, and hopefully I will. I guess the most important issue is to document that better in the future. Cheers Robert On 3/20/06, Evan Phoenix wrote: > > 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 defin= e > > 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 > > =3D> # > > irb(main):005:0> foo =3D Foo.new > > =3D> # > > irb(main):006:0> foo && 123 > > =3D> 123 > > irb(main):007:0> foo.send("&&", 123) > > HAHA > > =3D> 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) > > -- Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_3703_7847503.1142870422783--