dhesi@bsu-cs.UUCP (Rahul Dhesi) (07/31/87)
In article <112@stargate.UUCP> pleasant@rutgers.EDU (Mel Pleasant) writes: >RFC976 defines the @ network character as having precedence over >the bang (!) when both appear in mixed mode addresses. The quoted use of the term "precedence" is frequently used to mean that when a mailer sees a construct of the form a!b@c it groups it as (a!b)@c rather than a!(b@c). This is an unfortunate use. Consider the statement: My algebra book defines the * arithmetic character as having precedence over the plus (+) in arithmetic expressions. This, by analogy with the previous quote, would imply that a+b*c would be grouped as (a+b)*c rather than as a+(b*c), which is wrong. I suggest that, since this topic is not going to go away, we say "preference" rather than precedence. Thus: RFC976 defines the @ network character as having preference over the bang (!) when both appear in mixed mode addresses. There was an established meaning for the phrase "precedence of operators" long before any of the RFCs existed. I believe we should preserve that meaning. -- Rahul Dhesi UUCP: {ihnp4,seismo}!{iuvax,pur-ee}!bsu-cs!dhesi
kre@munnari.oz (Robert Elz) (08/05/87)
In article <908@bsu-cs.UUCP>, dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: > The quoted use of the term "precedence" is frequently used to mean that > when a mailer sees a construct of the form a!b@c it groups it as > (a!b)@c rather than a!(b@c). > ... > This, ... would imply that a+b*c would > be grouped as (a+b)*c rather than as a+(b*c), which is wrong. No, that's not quite right. In both mathematics, and network address parsing, "precedence" implies ordering of the operations, highest precedence means "do it first". In mathematics, parentheses can be used to force precedence to a particular operator or expression, so its entirely sensible to write "a+(b*c)" if that's what you prefer (or "(a+b)*c" if that's what you mean). In mail headers, parentheses mean comments, so its totally absurd to write "h!u@d" as "h!(u@d)" or "(h!u)@d". Nor is it sensible to use those forms in any kind of analogy with mathematics. Just think of precedence as "do it first" and apply that to the address, in order to "do" a network address operator, you (notionally at least) send the mail to the indicated host (rhs or lhs as appropriate), and pass it the other operand to interpret locally. With this definition, its entirely reasonable to claim that @ should have higher precedence than ! .. it just means that you should "do" the '@' first. This is totally consistent with mathematics where '*' having higher precedence than '+' means that you "do" the '*' first. I suspect that where the confusion arises, is that the operands of mathematical operators are numbers, and that's all (anything else must be reducible to a number). In net addresses the two operands are strings, one a "host" and the other "local information", and each of those contains all of the characters on the appropriate side of the operator (not just those out as far as some other operator, there isn't even a standard set of operators). Robert Elz
mouse@mcgill-vision.UUCP (der Mouse) (08/15/87)
In article <908@bsu-cs.UUCP>, dhesi@bsu-cs.UUCP (Rahul Dhesi) writes: > In article <112@stargate.UUCP> pleasant@rutgers.EDU (Mel Pleasant) writes: >> RFC976 defines the @ network character as having precedence over the >> bang (!) when both appear in mixed mode addresses. > The quoted use of the term "precedence" is frequently used to mean > that when a mailer sees a construct of the form a!b@c it groups it as > (a!b)@c rather than a!(b@c). Almost invariably so used, when discussing mail addresses. (Nor is it likely to change, as I shall explain.) > This is an unfortunate use. Consider the statement: > My algebra book defines the * arithmetic character as having > precedence over the plus (+) in arithmetic expressions. > This, by analogy with the previous quote, would imply that a+b*c > would be grouped as (a+b)*c rather than as a+(b*c), which is wrong. Heavens no. You have asked a tough one. Both uses are very natural, but it is difficult to say exactly why, when they are so obviously opposite in certain senses. But I'll have a stab at it anyway. The use of `precedence' in both cases means that the higher-precedence operator binds tighter, that is, it is handled first. Parentheses indicate that the pieces within them are to be taken as a unit with respect to whatever operations appear outside the parentheses. The point of difference is that for arithmetic, this means that the expression inside parentheses must be evaluated first, while in mail addresses, treatment as a unit means that the thing being treated as a unit must have its handling deferred until later, possibly on some other machine. Clear? I didn't really expect so, but I have to try.... der Mouse (mouse@mcgill-vision.uucp)