Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!princeton!caip!brl-adm!brl-smoke!kelem@aero2.arpa From: kelem@aero2.arpa Newsgroups: net.lang.c Subject: Precedent for use of = Message-ID: <1331@brl-smoke.ARPA> Date: Fri, 13-Jun-86 14:37:27 EDT Article-I.D.: brl-smok.1331 Posted: Fri Jun 13 14:37:27 1986 Date-Received: Sat, 21-Jun-86 06:41:45 EDT Sender: news@brl-smoke.ARPA Lines: 37 There is a 429 year precedent of using the symbol = for equality. The original rationale for using = for equality was given by Robert Recorde in 1557. The explanation was "... to auoide the tediouse repetition of these woordes: is equalle to: I will sette as I doe often in woorke vse, a paire of paralleles, or Gemowe lines of one lengthe, thus: =, {a very long equals sign} bicause noe .2. thynges, can be moare equalle." Granted, spelling is not the same, but = has served as equals in Mathematics for centuries. Fortran changed the meaning of = to assignment and equality was spelled ".EQ.". Algol 60 reverted to = for equality and used ":=" for assignment. This convention was followed by some of its successors: Algol 68, Pascal, and Ada. PL/I used = for both assignment and equality so that one could write confusing statements like " a = b = c; " (compare b with c and assign to a). The argument put forth in Kernighan and Ritchie is: "Since assignment is about twice as frequent as equality testing in typical C programs, it's appropriate that the operator be half as long." 1. There are over four centuries of mathematics using = for equals. Using = to mean assignment is begging for confusing code. 2. Assignment is a relatively new concept and a new notation is warrented. ":=" has enough precedent to serve this purpose. Is it really worth using a notation that is contrary to that of the more universal mathematics, and thus guaranteed to confuse novices and catch pros off-guard in order to type "=" instead of ":="? I think adding a few characters to improve readability and understandability is worth the time and effort. Consequently, I wrote a pre-processor for C called ac68 that uses := for assignment, = for equality, and has all the cumulative operators in the style of Algol 68: +:=, -:=, *:=, &:=, <<:=, etc. Unfortunately, the C and dbx messages refer to the operators that get generated. Still, the code is a lot more readable.