Assignment V equality (was: Bliss was Re: DEC program listing

Fred Cisin cisin at xenosoft.com
Wed Aug 17 15:55:01 CDT 2005


On Wed, 17 Aug 2005, Tom Jennings wrote:

> On Mon, 15 Aug 2005, Fred Cisin wrote:
> >>> I fail to see how i = i + 1 is not obvious to only but the most
> >>> simple-minded of people :)


Sorry, but I was NOT the one who said that.  Probably Sellam.

I DO see how it is not obvious, since I teach beginning programming
students.  Students who are SO beginning, that N = N + 1 is NOT obvious.
Many of them are actually otherwise intelligent, but they have not learned
how to think procedurally, and have been trained to think that '=' means
that two expressions are interchangable with each other.

And, therefore, if N is interchangable with 1 	N = 1
AND N is interchangable with N + 1  		N = N + 1
then, by "inductive logic", all integers are equal!
That would result in the immediate cessation of the universe as we know it
(and probably replacement with something even weirder).


> Variable reassignment is a new-fangled idea. Mathemeticians would
> once have corrected you:
>  	i' = i + 1
> variable values never changed, it would be considered an error.
thereby wasting the most important capability of a variable!


> Clearly programmatic convenience took over in comipiler tradition.
>
>
> And I disagree
>
>  	i = i + 1
>
> is not always obvious:
>
>
>  	if ( i = i + 1 ) ...

if you mean that as  IF (I .EQ. (I + 1) ) . . .
then the distinction between assignment and equality is significant.

We also must not forget numeric representations come into play.
float X;     /* as IEEE 32 bit single precision */
X = 2147483648.0;
if (X == (X + 1)) . . .       can come out as TRUE!!
(again: do NOT show that to a mathematician!)


> PS: I'm no purist, I prefer perl; I simply acknowledge I'm
> swimming in shit.

... the only thing as common as Hydrogen and stupidity!



--
Grumpy Ol' Fred     		cisin at xenosoft.com


More information about the cctalk mailing list