Hi –
That’s why Ruby’s interpretation of zero as “true” seems extremely
peculiar to me. There’s a geeky kind of logic to it, but it doesn’t
map onto the real world at all.
The real world is highly overrated as a template for programming
languages and the concepts underlying them.
how right you are - see below.
Consider that the following expression evaluates to true in Ruby (and
others):
“The earth is flat.”
Of course one could explore and discuss this example in various ways,
but the point is that there’s no self-evident, semantically-based
mapping between natural language and programming language here. The
same is true of comparing the statements “I have zero of X” and “The
expression ‘I have non-zero of X’ is false” and so forth.
p.s. Don’t get me wrong, I like Ruby. But, it has its warts
just like every programming language.
Perhaps… but this isn’t one of them. Really – it may not be
identical to C, Perl, etc. in this respect, but the implication that
this is a design glitch is really off the mark and potentially
misleading to people trying to understand how it works.
To the other explanations or glosses on this design decision you can
add: everything of a given class has the same Boolean value as
everything else of that class. Fixnum objects (all of them) are true.
There are no special cases, no legacy treatment, nothing thrown in “to
make the people feel at home”. It’s utterly smooth
and consistent in design, and it’s designed carefully with full and
deep awareness of how the same issue is handled in antecedent
languages.
David
i’m in agreement with you. IHMO the whole problem (or concept of one) here
stems from trying to put true, false, and ‘empty’ into the same two boxes -
but this is not really required and, in fact, it is more accurate to have the
notion of true, false, and something else; gÃd¶el showed this:
…
“Gödel is best known for his proof of “Gödel’s Incompleteness Theorems”. In
1931 he published these results in über formal unentscheidbare Sätze der
Principia Mathematica und verwandter Systeme. He proved fundamental results
about axiomatic systems, showing in any axiomatic mathematical system there
are propositions that cannot be proved or disproved within the axioms of the
system. In particular the consistency of the axioms cannot be proved. This
ended a hundred years of attempts to establish axioms which would put the
whole of mathematics on an axiomatic basis. One major attempt had been by
Bertrand Russell with Principia Mathematica (1910-13). Another was Hilbert’s
formalism which was dealt a severe blow by Gödel’s results. The theorem did
not destroy the fundamental idea of formalism, but it did demonstrate that any
system would have to be more comprehensive than that envisaged by Hilbert.
Gödel’s results were a landmark in 20th-century mathematics, showing that
mathematics is not a finished object, as had been believed. It also implies
that a computer can never be programmed to answer all mathematical questions.”
…
from
http://www-groups.dcs.st-and.ac.uk/~history/Mathematicians/Godel.html
cheers.
Ã
-a
ps. vim is having a problem with some of these chars… hopefully this msg
isn’t too badly formatted…
···
On Wed, 19 May 2004, David A. Black wrote:
On Wed, 19 May 2004, Michael Geary wrote:
–
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
URL :: Solar-Terrestrial Physics Data | NCEI
“640K ought to be enough for anybody.” - Bill Gates, 1981
===============================================================================
–
EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov
PHONE :: 303.497.6469
ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328
URL :: Solar-Terrestrial Physics Data | NCEI
“640K ought to be enough for anybody.” - Bill Gates, 1981
===============================================================================