On Nov 22, 2007, at 4:07 PM, Waldemar Kornewald wrote:

The absence of precedence between operators is a small price to pay,
because you gain minimality, consistency, and semantics at the right
level: messages sent to objects, not some domain-specific
"mathematical" operation.

I do understand that you like this kind of elegance, but I think the
price to pay is pretty high because it increases the likelihood of
mistakes (in either math or Smalltalk "mode"). Modality is a
well-known cause of errors and should be avoided. Precedence could
simply apply to +-*/, so nothing complex to learn.

Ian, what do you think?

I think whichever makes the expression of intent the clearest is the one to use in any given situation. That it might have to come with copious comments, flashing red 'danger bars' in the editor, or whatever, is a detail for the UI and tools to get right.

Clarity can be in the eye of the writer or the reader, so an ideal solution might employ bijections between visual/editable representation and stored semantic structures throughout the programming tools. If X wants to write with conventional arithmetic precedence, import (or write) the two or three lines of syntax declaration that makes certain binary operators behave that way. If Y wants to read the code without operator precedence, the underlying structures are converted (in the absence of precedence modifications) with the operators appearing in a different order, possibly parenthesised. I can see how this could rapidly break down into chaos and confusion, but before it's abandoned I think someone (or several people) should make serious attempts to find a practical and satisfying solution.

(If we take this to the extreme, even Forth programs might one day be readable. ;-)

In the meantime: given that the object system was created to eliminate C(++), and the message syntax was created to keep me sane, and I can never remember the traditional (C or similar) precedence rules without a huge poster on my wall and lots of redundant parentheses to be 101% sure the compiler understands them too, I have to side with the three-level 'message-passing' precedence rules. But, with the promise that it will be trivial for anyone to change the way any particular selectors are parsed in the very near future.

Cheers,
Ian


_______________________________________________
fonc mailing list
[email protected]
http://vpri.org/mailman/listinfo/fonc

Reply via email to