Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!ark From: ark@alice.UucP (Andrew Koenig) Newsgroups: net.lang Subject: Re: Operator Precedence Message-ID: <4275@alice.UUCP> Date: Thu, 5-Sep-85 18:26:03 EDT Article-I.D.: alice.4275 Posted: Thu Sep 5 18:26:03 1985 Date-Received: Fri, 6-Sep-85 05:35:29 EDT References: <262@pedsgd.UUCP> Organization: Bell Labs, Murray Hill Lines: 24 > I have a question. How did we end up with operator precedence in the > first place? This seems to cause many more problems than what would > seem to me to be obvious for algebraic expression - evaluate left > to right in the absence of parenthesis. It seems to me that most > programmers fully parenthesize anyway to avoid being bitten. > Can anybody make a compelling case for not doing it this way? OK, let's evaluate A=B+C strictly left to right. First we copy B into A, then we add C to A. Now what do we do with the result? Throw it away, I suppose. I'm not being completely flip: that is exactly what C does if I parenthesize the above expression so as to evaluate it strictly left to right: (A=B)+C What to do? Three solutions come to mind: 1. Treat = specially. This re-opens the precedence issue. 2. Make assignment store into its RIGHT operand, as at least one language (Neliac) has done. Thus if we want to set A to the sum of B and C, we write B+C=A 3. Make all operators group right to left, as APL has done.