Andrew Savige
3/26/2009 8:03:00 PM
Heesob Park wrote:=0A> According to the japanese reference=0A> manual(http:=
//doc.loveruby.net/refm/api/view/spec/operator),=0A> this is not a bug.=0A>=
I guess this precedence change was made on ruby 1.8.0=0A>=0A> C:\work\ruby=
168\bin>ruby -v -e 'p ~2**3'=0A> ruby 1.6.8 (2002-12-24) [i586-mswin32]=0A>=
-9=0A>=0A> C:\work\ruby180\bin>ruby -v -e 'p ~2**3'=0A> ruby 1.8.0 (2003-0=
8-04) [i386-mswin32]=0A> -27=0A=0AThanks. Here's another one that surprised=
me. Running:=0A=0Ay =3D 5 % x =3D 3=0Aprint "x=3D", x, " y=3D", y, "\n"=0A=
=0Aproduces:=0A=0Ax=3D3 y=3D2=0A=0AThat is, it seems that:=0A=0Ay =3D 5 % x=
=3D 3=0A=0Ais being parsed as:=0A=0Ay =3D 5 % (x =3D 3)=0A=0Adespite the %=
operator having a higher precedence than the =3D operator.=0AI expected it=
to be parsed as:=0A=0Ay =3D (5 % x) =3D 3=0A=0Aproducing a syntax error.=
=0A=0AIf this is a deliberate feature, I'd be interested in learning more a=
bout it.=0AIf anyone knows a good reference on the Ruby parser, please let =
me know.=0A=0AThanks,=0A/-\=0A=0A=0A=0A Enjoy a safer web experience. =
Upgrade to the new Internet Explorer 8 optimised for Yahoo!7. Get it now.