Precedent for use of =

C Waldman cgw at mruxe.UUCP
Sat Jun 21 01:36:39 AEST 1986


 
In article <1331 at brl-smoke.ARPA>,  kelem at aero2.arpa writes:

> There is a 429 year precedent of using the symbol = for equality.
     ...quote deleted...
> 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.

No, no, no!  It seems like you are a little confused about the meaning
of the equals sign in mathematics. It's true that math uses = for equals,
C uses = for equals too.  The problem is that there are three meanings
of 'equals':  "math uses = for equality" is a true, but totally ambiguous
statement. The three meanings, as I see them:

A)  test for equality,      as in 'is x equal to 6?'    (interrogative) 

B)  assignment of equality, as in 'let x equal 6!'      (imperative)

C)  assertion of equality,  as in 'on a right triangle the square 
         of the hypotenuse is equal to the sum of the squares of
         the two shorter sides.'                        (declarative)

Meanings B and C (and rarely A) are used in math, with only one 
symbol (=); and your claim that "assignment is a relatively new 
concept" is erroneous. 

In programming, we do not state theorems (yes, there are some
programs that can chew up theorems, but they don't classify as
programming languages),  we are interested in telling the computer
to DO something: therefore we are interested in meanings
A and B.  They are both 'equals', but in different senses.  We
need two symbols to avoid ambiguity. As a user of both C and Pascal,
I can appreciate the logic in using the shorter symbol for the
more commonly used meaning (I HATE typing :=, especially since
you have to hit SHIFT to get the colon, half the time, if I'm
typing fast, I get :+).  If anything, maybe I would agree with
a different symbol for meaning A, like ?= or =? or something,
but it's not worth making a change. If it ain't broke, don't 
fix it.



More information about the Comp.lang.c mailing list