No Such Thing

mwm at ucbopal.CC mwm at ucbopal.CC
Sat Aug 24 14:19:51 AEST 1985


From: Mike (I'll be mellow when I'm dead) Meyer <mwm at ucbopal.CC>

I have avoided posting (for the most part) recently, but:

In 868 at brl-tgr.ARPA jim cottrell (cottrell at nbs-vms.ARPA) says:
> Flame On! THERE IS NO SUCH THING AS A BOOLEAN!!! Flame Off.

:-) Ok, we now know that jim doesn't believe in true and false. Does
he drop right and wrong at the same time? How about write and read? :-)

> In case you hadn't noticed, `<' & company are infix operator that
> return a constant `zero' or `one'. Thus, *every* conditional using
> the `boolean' operators ultimately reduces to either
> 	if (0) { ... }		or 	if (1) { ... }
> THIS IS NOT A KLUDGE! It is the WAY IT SHOULD BE! What could be
> more mnemonic (except to a nihilist :-) than TRUE if nonzero, and
> FALSE if zero. One of C's design virtues is that it is minimal, yet
> (relatively) complete. Don't drag outmoded concepts into the future!

TRUE if nonzero, FALSE if zero? Sounds like jim just built a map from
the set of C integers to booleans. But booleans don't exist, so such a
map can't exist. Maybe what jim meant was:
	if (expression) { ... }
is the same as:
	if expression is non-zero then { ... }.

BTW, for something more mnemonic that
	0 -> FALSE, {x | x /= 0} -> TRUE,
how about
	nil -> FALSE, {x | x /= nil} -> TRUE, or
	{x | x = 0 mod 2} -> TRUE, {x | x = 1 mod 2} -> FALSE?

Second BTW: C is not minimal. It's not bad, but there a half-dozen or
so languages that have fewer operators, and equivalent completeness.
Most of those are harder to use than C, though.

> > Many Boolean expressions are not best thought of as comparison of
> > an arithmetic quantity against zero.  For example:
> > 	while ( ! Done() )
> > 		Perform_Action();
> 
> We agree, but for different reasons. You insist on dragging in
> an outmoded concept, then complaining that it doesn't fit very well.
> I just read what it says.

Sorry, but you've got it backwards. He's trying to pull a modern
concept (TRUTH :-) into an obsolete language. Of course, if your
language is nothing more than a high-level assembler, then using the
funny "zero is false" map is ok, providing the underlying hardware
doesn't provide a boolean type of it's own.

> > I am pretty conservative
> 
> I think this pretty much sums it up.

Yeah - somebody who expects the programming languages to make their
job easier is pretty conservative. I'm that way to - I want a language
that makes it easy to turn my thoughts into code. This is why I prefer
ALGOLW or C to FORTRAN or BASIC, and CLU or LISP to ALGOLW or C.

> Actually, Doug, I'm not so much writing this to you as much as
> all those other people out there who insist on fortrash as a model
> for all their computing. Sorry about the cheap shot, but I wish you
> were a little more daring in your philosophy. K & R were.

Sorry, but I can't resist: Jim, from where I stand, *you* insist on
fortrash as a model for your computing. There are more similarities
between C and fortrash than differences. The C "if x is zero then ..."
reminds me of the fortrash arithmetic if. But further discussion
belongs in net.lang.*

	<mike

"Truth is variable."

* disclaimer: I like C. It's easily the best language to come out of
the early '70s I've seen. However, this does not imply that 1) it's
perfect; or 2) there aren't better general purpose languages
available.



More information about the Comp.lang.c mailing list