[DGD]1.1.52

Par Winzell zell at ncal.verio.com
Sun Mar 14 00:34:10 CET 1999


Folks,

> Can anyone tell me what I'm trying to say?

I wouldn't presume :)  -- but I'll try to briefly explain why I agree.
First, in general, I've always liked having a real boolean type. Many
people don't. Argument probably fails to change this fact. However, I also
think the new nil value has pushed the case in favour of the yay-sayers.

Previously, 0 was clearly not only false, but -the- false. Everything that
now results in nil resulted in zero. Yearning for true booleans meant
discarding a consistent (if slightly ugly) system for the promise of
something better.

Now, things are different. There is a new false in town, 'nil', and it is
clearly the superior one. Numbers 0 and 0.0 are reduced to convenient
aliases for nil in comparisons, really, just as non-nil, non-zero values
are aliases for truth. With a new value introduced whose only purpose in
life is to be false, half of a real boolean system is suddenly in place,
making it all the more attractive to take the last step.

If nil is the definite false, why is !nil -> 1? Ugly! Even worse, !!nil ->
0. This was tolerable and consistent when 0 meant false and false meant 0,
and it still works when applied to integers and floats, but it makes no
sense for strings, arrays, objects and mappings.

The only alternative I can think of is this: introduce a boolean type and
a truth value, letting nil be false. Let ! always map into this type, and
make 0 and 0.0 aliases for nil in comparisons the same way all non-nil
strings, arrays, objects and mappings are aliases for true. This allows
e.g.

        if (!some_number == !this_object()) { ... }

for all those of you who don't want to have to compare integers explicitly
with zero. :-)

Is this consistent?

Par


List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list