No Such Thing

COTTRELL, JAMES cottrell at nbs-vms.ARPA
Fri Aug 30 06:48:56 AEST 1985


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

That's MY slogan too.

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

Cute.

> > 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 { ... }.

That's what the book says.
 
> 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?

As for the first, sounds like LISP. Are you proposing a funny predefined
`thing' called `nil' that points to itself like in LISP? Will we have
to cast all our tests to the proper type?

As for the first, sounds like VAX Fortran. Since the VAX is 
little-endian, the low bit test words on all LOGICAL*[124] types. 

There have been all sorts of true-false mappings & conventions. Let's
not forget using the sign bit. Anyway, to my mind, (& evidently to
K&R) the use of zero to represent false is the most reasonable
thing to do, if restricted to *in-band* values. When you ain't
got nothin', you got nothin' to lose.

> 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.

Okay. What I mean by minimal is that it includes only those features
truly necessary to fully describe an idealized portable machine and 
which have meaning to the compiler. There is no exponentiation because
few (if any) machines have it as a primitive. There is no repeat-until
statement because that is a trivial variation of a while. There is no
I/O, sets, booleans, complex numbers, or inline functions (except 
sizeof) that most other general purpose languages have.
 
> > > 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.

Like What? Zero is the most unique & important constant in the universe!
All (or 99.99%) machines have a branch on (non)zero & some even have
clear instruxions. 
 
> > > 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.

Why do you keep putting a `W' on the end of `ALGOL'? I haven't a CLU :-)
 
> > 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.*

Twisting things around a bit aren't we? I never even used the
arithmatic if except when I was a freshman & thought it was cute.
There are two main features of a language as I see it: 1) control
struxures, & 2) data struxures. Fortran 77 has matured somewhat in
the former, but leaves a lot to be desired in the latter.

> 	<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.

1) Agreed. I have criticized C as well in this very forum.
2) Maybe so. But *widely* available?

	jim		cottrell at nbs
*/
------



More information about the Comp.lang.c mailing list