Assignment in test: OK?

Bruce Worden bruce at seismo.gps.caltech.edu
Fri Sep 14 09:08:05 AEST 1990


In article <3749 at goanna.cs.rmit.oz.au> ok at goanna.cs.rmit.oz.au (Richard A. O'Keefe) writes:
Quoting me:
>> are legal, I don't see how `:=' is any better than just `='.  People who
>> are used to thinking of `:=' as `equal' will type it as freely as we 
>> type `='.

>But there _are_ no people who are used to thinking of ":=" as "equal".
>Algol 60, Algol 68, Pascal, Modula, Modula-2, Modula-3, MESA, Ada,
>BCPL, ... all use ":=" for assignment.  Is there any well known language
>that uses ":=" for equality?  Surely not.

But that was not my point and I am not interested in arguing with you about 
what goes through people's minds when they type `=' as opposed to `:='.  
Apparently it would be futile for me since you seem to know what every person
in the world thinks when he encounters `:=', or, at least, what he doesn't 
think.

(I think of `=' as `equals' and `==' as `equals equals' when I am typing 
them--arguably the worst possible way to think about it, but I have only made 
the error in question twice and in both cases it was a typing error not a 
logical one.  I would think of `:=' as `equals', too, along with almost any
other symbol that did the same job.  If you really want to emphasize the 
assignment nature of expressions like `x = y;', then an equal sign has no 
place in the symbol you use to do it.  How about `let x take on the value of 
y;'?  No ambiguity there.)

>> Only something like Fortran's .EQ. is different enough to 
>> draw attention to the two different meanings of `is equal to'.

>What "two different meanings"?  Assignment is _not_ a meaning of
>"is equal to" and never has been.

What, now I have to argue semantics with a guy who uses underscores to
(apparently) emphasize words in English sentences?  (Especially since
they don't need emphasizing in the first place.)  Nobody that wrote to
me had this problem; they all knew what I was talking about (even if 
they didn't agree with me.)  Are you being deliberately obtuse?

>> I am not objecting to constructs like:
>> 	if((fd=open(path,flags,mode)) != NULL)

>You _should_.  Assuming POSIX for open() and ANSI C for NULL,... [ complains,
> gives example ]

There you go again.  Since I did not define any of the identifiers and
I specifically mentioned the construct (in the context of the rest of
this discussion), you don't have any business assuming anything except 
that the example is written in C.  Just because it looks like the standard 
library open() does not mean that it is.  It so happens that open() in the 
example above is defined as `static struct data *open()' and is used within a 
small database library.  Now don't you feel silly?  You should.

>Heuer's Law:  Any feature is a bug unless it can be turned off.

Hmmmm, looks like a case of Heuer worship.

--------------------------------------------------------------------------
C. Bruce Worden                            bruce at seismo.gps.caltech.edu
252-21 Seismological Laboratory, Caltech, Pasadena, CA 91125



More information about the Comp.lang.c mailing list