Order of precedence

Travis Griggs tgriggs at keyww.com
Wed Jan 27 19:01:03 UTC 1999


Eliot & Linda Miranda wrote:

> Ian Bicking wrote:
>
> > In message Tue, 26 Jan 1999 09:38:32 -0800,
> >   glenn <krasner at objectshare.com>  writes:
> > >       c) cater to adults and children already computer-skilled who have
> > > preconceived notions set by some other computer languages which have
> > > multiple rules, one operator-based and the other left-to-right (or
> > > right-to-left or some such).
> >
> > I'm not saying that the normal, mathematical rules of precedence are easier
> > for children.  Quite the contrary -- Smalltalk's simple left-to-right rule
> > is much more intuitive.  This is the problem.  A child who is introduced to
> > Smalltalk's system would likely have their intuition reinforced, making it
> > all the harder to learn the proper (mathematical notation) rules of
> > precedence.
> >
> > The fact of the matter is, mathematics says that 3+4*5=23.  You can't change
> > that -- the mathematical conventions of the world are not going to be
> > changed because they are easier for the computer to parse.  In a practical
> > matter, those conventions have been created because they *are* easier to
> > parse (for humans) in real-world situations.  They lead to less parenthesis.
> > They group factors.  They *are* aesthetic.

Mathematics does not say that 3 + 4 * 5 = 23. I have never seen any mathematic text refer to multiplication using the asterix character. I have watched this thread here and in c.l.s. for a while now. I am some what of a sci/math/eng type. I've been doing ST in eng apps for going on 9 years. I used to work in the Nuclear industry where the equations or so hairy that reading them will put hair on your chest. My degree is in Mechanical Engineering. I did alot of math in high school. And so I went back and looked at some of my high school and M.E. homework. I cannot find a single instance where I wrote out
statement that depended on the ol' "multiply first" rule, though I like other's learned this rule early on in life. I've got a slew of my M.E. and C.S. college texts sitting around me and have spent the last half hour looking at them trying to find one instance where application of this rule would dissambiguate a situation. I can't. The truth, I have yet to find a case where the cross product symbol (the grade school multiply operator) is used at all. I have hardly even found any dot notations. Most multiplications are just implied by adjacent neighborship. Basically, the only rule I can see that
applies is that you combine symbols that are spatially closest to each other. Having worked with FORTRAN codes that model nuclear thermodynamics and nuclear kinetics down to the cubic centimeter, I never came across an instance where the FORTRAN rules or precedence weren't reinforced by grouping terms. It was considered bad style to employ the mathematic rules. Interesting statement huh? Here you have these rules in a language for your benefit, and no one wants to use them, because it makes the code harder to read. In short, I'm really struggling to see the value that would be gained from coming up with
some sort of scheme that would apply the "multiply first" rule. Exist it might, I consider the rule of no value, since I'm not finding any real world examples of its use.

--
Travis Griggs (a.k.a. Lord of the Fries)
Key Technology
tgriggs at keyww.com
Member, Fraven Skreiggs Software Collective
 - C for Sinking
 - Java for Drinking
 - Smalltalk for Thinking
 ...and Power to the Penguin!





More information about the Squeak-dev mailing list