Le 26/06/2014 18:11, Richard Sargent a écrit :
Esteban A. Maringolo wrote
If one thing confuses people in that realm is non arithmetic precedence:
Eg. 2 + 3 * 4 = 20 instead of the "expected" 14.
And we're not going to change that either. It's not worthy, and I
doubt if it is possible at all.
I'm probably late to the party with this reply. The primary reason for not
changing this is that it would be incorrect. It comes down to intrinsic
versus extrinsic meaning. A multiple operator has an intrinsic meaning: it
means multiple. But a message name does not have intrinsic meaning (other
than it is a good idea to have the name represent what it does). The meaning
of a message is determined by the receiver. e.g. if PetitParser defines #*
to mean "0 or more repetitions", what happens when someone has decided that
it should be evaluated before #+?
Message sending precedence can only be defined in terms of the type of
message: unary, binary (or infix), and keyword, since the interpretation of
the message is the receiver's responsibility, not the compiler's.
You could do it, but then you would have to wire the smalltalk parser
with additional data (binary messages precedence) that would have to add
a way or another to your binary method definition.
Thierry
--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95