Re: Operationalize orthogonality
Date: 1 Jun 2006 06:03:01 -0700
Message-ID: <1149166981.471332.306780_at_y43g2000cwc.googlegroups.com>
Pickie wrote:
> I ask because these seem to me to be basic concepts (or primitive types?)
> and both of them have simple ways to represent a boolean (zero and
> empty string respectively being false, all else true).
I didn't comment on this sentence before, and I'm surprised nobody else
has either.
So far as I'm concerned, this sort of overloading of values is utterly
shoddy. A number is a number, a string is a string and a boolean is a
boolean. This sort of overloading is precisely the sort of nonsense
enumerated types were invented to resolve. Say we had this sort of
situation, in a Pascal-ish language :
const Sunday = 0; Monday = 1; Tuesday = 2; Wednesday = 3;
const False = 0; True = 1;
var who_knows_1, who_knows_2, who_knows_3 : integer
begin
Now, what on *earth* did any of that nonsense mean ? And don't say "but
you'd never code like that". If you overload values that way, that's
the way you're coding all the time. And the real killer is that nothing
in the world will ever prevent you from writing tosh like that, and
nothing will be able to help you as and when it all goes wrong. This is
the sort of thing type transfer functions were invented for.
const Red = 0; Green = 1; Blue = 2;
who_knows_1 := Green * Tuesday;
who_knows_2 := Blue + True;
if (who_knows_1 * who_knows_2 > (Green+Blue*Wednesday)) then
who_knows_3 := False
else
who_knows_3 := True + Sunday;
end;
Really. The one really good thing Pascal brought us. Received on Thu Jun 01 2006 - 15:03:01 CEST