I think you're right--to do mathematical notation, you'd need mathematical precedence and standard function notation. In addition, you'd need to use conforming operators not #*, exponents denoted by graphic position not with bogus operators such as #^, elided operators for multiplication, horizontal lines for division, tall integrals, etc. etc. etc. That would be cool.
Short of that, though, and you are asking the users to learn a necessarily incompatible (non-conforming) set of rules and you expect them to be able to go back and forth between their computer notation and their math notation. In that context, I don't see the relative precedence of #+ and #* as particularly significant, and my sympathies lie with simplicity.
glenn
At 10:45 PM 1/26/99 -0500, Ian Bicking wrote:
In message Tue, 26 Jan 1999 09:38:32 -0800, glenn krasner@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.
Perhaps the real answer is to have a view of Squeak where the syntax is fully mathematical. Where 3*sin(x^2+2) works. In this view a child could learn mathematics. But it seems that a better solution could be made, one that encompasses both needs (simplicity and conformity) instead of requiring a break-away syntax.
I bring this up because I've been looking at Logo, and one of the big compromises they made in the syntax was to allow infix notation even though it wasn't part of the Lisp tradition and sullied the syntax quite a bit.
Now, this is all assuming that a goal of Squeak (distinct from Smalltalk) is as a pedagogical tool. This is by no means necessarily true... though it would be neat if Squeak could be used by children, that doesn't mean it needs to be created for them to learn from it (though, of course, it is impossible to seperate use from learning). Pedagogically, introducing something that looks almost like proper mathematical expressions but isn't is a bad thing to do. This is one reason (not necessarily a huge reason) that I don't think Squeak is ready for children.
-- Ian Bicking
glenn wrote:
I think you're right--to do mathematical notation, you'd need mathematical precedence and standard function notation. In addition, you'd need to use conforming operators not #*, exponents denoted by graphic position not with bogus operators such as #^, elided operators for multiplication, horizontal lines for division, tall integrals, etc. etc. etc. That would be cool.
Since Squeak now has mechanisms for enhanced source code storage, what about a kind of text emphasis that says "render this expression in standard math notation"?
Smalltalk would see (c at: i) at: j put: ((a at: i) at: j) * ((b at: j) at: i) but the user would see (properly rendered, of course)
c := a b ij ij ji
and this expression could be manipulated graphically. At least in Morphic, this would be feasible. The MVC browser would just show the Smalltalk code, perhaps with a color indication or so to give the user a hint that this is meant as a mathematical formula.
Hans-Martin
squeak-dev@lists.squeakfoundation.org