From: "Jürgen Strobel" Date: 2006-08-31T00:54:08+09:00 Subject: Re: and and or priority --/04w6evG8XlLl3ft Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 29, 2006 at 08:55:09AM +0900, Michael W. Ryder wrote: > Pavel Smerk wrote: > >OMG! > > > >Why the and and or operators have the same priority? Unlike && and ||=20 > >and also unlike the most of, or maybe all, other languages and conventio= ns? > > > >(Yes, long time spent on that now, who would expect such a curiosity...) > > > >Thanks for explanation, if there is any, > > > >P. >=20 > Smalltalk evaluates and and or operators the same way. Most evaluation= =20 > is done from left to right with only a few different priorities. Yes, and this is consistant behaviour for Smalltalk, as Smalltalk uses left to right evaluation even for +, * arithmetic. I wouldn't say it is wrong the way ruby does it, but not exactly intuitive either. Choosing to follow english language rather than widespread convention *and* similiar constructs in ruby itself (&&, ||, +, *, ...) may seem a bit ... anti POLS. I feel this is a true case of POLS violation, not one of those "I don't know shit, and I was surprised" examples. I do know about operator precedence in ruby in general, and was surprised by this special case. Never ran into it myself though, probably because of luck or spurious parentheses. It's not a major deal. It certainly can't be changed in 1.8 without breaking code. Who feels this is worth changing in 1.9? -J=FCrgen --=20 The box said it requires Windows 95 or better so I installed Linux --/04w6evG8XlLl3ft Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (GNU/Linux) iQEVAwUBRPW0gvy64gyiEfXtAQLtRggA0fFbXqmJKXW/4DCMAkp4hqRtW9IeRttF sN6lT6iMqvn1vvnIJEoGt41Xa22EjZBsI0stDWlaAZvTQ45mpeojf5sh3IoXEf9c v4yz3CVgE4EcsG5X9dAeAyDibcb7H7ARxPovo2dE6ZFxW6BWg/WSZ+ly8k+OA2hd 9KNZXfOHdpKuhVj/8y+DnuKHxpv8M219yb8zYaTj0Gl3Ht04sO37hC84v8Ennwdn LQIfzt48IB53a5sfOUKqHDnlCC/2SE62y5rNNZiNMgBSEcOxgwXuLaBQiFMm6JMr dmuk7WqX9UmNiX6MUsU6ylq4lC5/1eqlOat/+KQK/tVbo9wApGFuFg== =lSQg -----END PGP SIGNATURE----- --/04w6evG8XlLl3ft--