Order of precedence

Bijan Parsia bparsia at email.unc.edu
Tue Jan 26 18:30:13 UTC 1999

On Tue, 26 Jan 1999, Matthias Ernst wrote:

> glenn wrote:
> > 
> > 
> > Sure, those adults or children who have been initially taught a particular
> > precedence order in certain programming languages seem to come with a
> > perferred "use", but they already have the concept of precedence in
> > computer languages.
> This is not a matter of which programming language one learns but the
> fact that
> they all imitate the mathematical notation of multiplication and
> addition. And
> everyone learns that in maths, '*' (which actually is a \cdot in maths)
> has a
> higher precedence than '+'.

Or adjacency, or 'x' ('times' sign, which is what I used in elementary
school; got very muddled when I encountered cross-product), or...

> d) cater to adults and children who have preconceived rules set by their
> maths teacher.

I had a dicussion with someone who thought that Smalltalk's operator
precedence was wierd until I pointed out that *read aloud* left to right
makes perfect sense:

	"Two times three plus seven."

(Of course, pauses and inflections can alter precedence, the way
parentheses do.)

This is particularly true for very long expressions, e.g.:

In so far as Smalltalk should be read aloud (and I think it should) that
seems to be some reason to favor the left to right only precedence rule.

Bijan Parsia

More information about the Squeak-dev mailing list