Correction 3 (Re: Syntax & Sematics [was: Re: [Enough already ] Re: Proposal3:)

Florin X Mateoc mateoc_florin at jpmorgan.com
Wed Jun 7 17:45:14 UTC 2000


The arithmetic "precedence" rules in Smalltalk are problematic not because they
are conforming with a different paradigm, but because they are non-conforming
with the very paradigm they are "supporting" - that is, sending messages to the
APPROPRIATE objects. Numbers are not the "natural" receivers for binary
operators, ordered pairs are.
So if we had #+ implemented (as a unary message from Smalltalk's perspective) in
Array (just an example), there would be at least consistency (with both math and
OO) in parsing

(Array with: #(4 5) + with: 6) *

Even for beginners, I think consistency provides greater benefits than the
currently implemented "friendlier" approach.

Cheers,

Florin





bparsia at email.unc.edu on 06/07/2000 11:06:04 AM

Please respond to squeak at cs.uiuc.edu

To:   squeak at cs.uiuc.edu
cc:   (bcc: Florin X Mateoc)
Subject:  Correction 3 (Re: Syntax & Sematics [was: Re: [Enough already] Re:
      Proposal3:)




On Wed, 7 Jun 2000, Mats Nygren wrote:

> "Andrew C. Greenberg" <werdna at gate.net> wrote:
[snip]
> >  4 + 5 * 6
[snip]

> Your unconstructive tone of voice dont deserve this, but here goes:
[snip]

> Another item, this will not be well recieved here, I write it because
> it is true.

Though I've been sympathetic toward aspect of your stance, I feel like
reiterating your comment above. Espeically since it's arguable that what
you write is *false*.

>The great start for confusion in the case of "4 + 5 * 6"
> is the design of ST-80. Very close to all the rest of the world parses
> that as (4 + (5 * 6)).

This is simply not true, at least from a certain perspective. Entering
numbers into an "office type" calculater almost *always* works on a left
to right ordering, as does adding by paper, or doing "mental arithmetic",
i.e.,

     4 *plus* 5 *times* 6

Read that aloud and tell me that you'd do (4 + (5 * 6)).

There is a *vocal* convention for grouping, at least in my
hearing: speeding up:

     4 *plus*              5times6

But you will piss off the person operating the calculator if you do that.

So if you read '4 + 5 * 6' *naturally* (at least in my English), I would
be highly surprised if you would get the "unnatural", precedence laden
version.

So, so much for "very close to all the world"

> You cannot possibly blame me for that
> confusion. Do you really believe that mathematicians in the end will
> change to ST80 syntax?

For programming Squeak? Why not?

Do you really believe that mathematicians will be happy with C
'formulas'? I think not. APL anyone?

Frankly, how many mathematicians spend much time dorking around with
arithmatec anyway? Number theory sure. But dinky little calcuations?

I mean, if we're going to support *mathmatics* let's support
*mathmatics*. We have the fonts, we have the layout prowress :)

Mark Guzdial students are working on it. ;)

[snip]

So let's dispense with this canard once again. Most mathematicians of my
knowing don't use '*' for multiplication anyway, the seem to use
adjacency. And then tend to rely on parentheses *anyway* for
disambiguation, which we all should for "formulas" of any length (or
intermediate calculations).

There is enormous pedegogic value, in my experience, in the English like
predecence of the binary messages---it really helped me, and I see helps
others, start thinking in terms of message sends. That is *way* more
important to me that a bit of infix.

(Let's not even *go* into the prevelance of reverse polish, which is, I
believe, *very* common in engineering circles where, I understand, quite a
bit of calculation occurs.)

Cheers,
Bijan Parsia.








This communication is for informational purposes only.  It is not intended as
an offer or solicitation for the purchase or sale of any financial instrument
or as an official confirmation of any transaction. All market prices, data
and other information are not warranted as to completeness or accuracy and
are subject to change without notice. Any comments or statements made herein
do not necessarily reflect those of J.P. Morgan & Co. Incorporated, its
subsidiaries and affiliates.





More information about the Squeak-dev mailing list