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

Tom Jennings tomj at wps.com
Wed Aug 17 14:00:13 CDT 2005


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 :)

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.
Clearly programmatic convenience took over in comipiler tradition.


And I disagree

 	i = i + 1

is not always obvious:


 	if ( i = i + 1 ) ...


If i represents a logical variable or function or subroutine, then
then result is false. Modern languages assume that any non-zero
value is true, but that's not the case for all languages, and
"true plus one" or "false plus one" would generate a compiler
error.

Even if you assume i is a numeric variable, and a numerical value
of zero is logically false, then the statement will be true for a
large number of values of i, depending on word length, how many
representations zero has in the machine (1's comp? 2's? float?
normalized?)

et cetera...


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




More information about the cctalk mailing list