[Python-Dev] bools aren't ints in Fortran

Paul F Dubois paul@pfdubois.com
Sun, 10 Mar 2002 10:16:56 -0800


Paul Prescod wrote to Tim:

> Here are other languages that (based on some admittedly cursory
research) treat booleans > as entirely distinct from
> integers:

> * Scheme
> * SML
> * JavaScript
> * Visual Basic
> * Eiffel
> * Smalltalk

> I'd be curious to hear a list of high level, GC'd languages in the
other camp. Methinks > your Fortran/C bias shows. ;) And it isn't
pretty."

Add to your list, "Fortran", which has type "logical". This makes the
bias comment self-canceling, but reinforces the argument against bool
being a special case of int.

I think bools as ints started as a "close to the hardware" motivation,
and doesn't have much of a place in modern programming. All the
arguments for it seem to be claims for ease of expression but against it
is ease of correctness. I think the latter is necessary and the former a
nicety.

BTW, the Fortran standard does not specify a representation for logical,
and there was even a period where mixing libraries compiled with
different compilers on the the Crays  could get errors because the
representations differed. One compiler had chosen to use a hardware
feature that made it quick to test a sign bit. This points out another
fallacy with making bool a subclass of int -- it binds the
implementation too much to one view. 

True + True is neither True nor False. Hmmmmmm....