DMD 0.148 release
bobef
bobef at lessequal.com
Sun Feb 26 00:39:48 PST 2006
Derek Parnell wrote:
>
> Zero is frequently used to implement the concept of falsehood and
> likewise non-zero for truth, however the semantics of integers is not
> the same as the semantics of booleans. But because many C programers are
> just *so* used to thinking this way they have become to believe that
> zero *is* falsehood rather than just a number chosen to implement the
> concept.
>
Just thoughts...
Well back in school we were learning boolean algebra. (for some
electrical crap... I don't remember... I don't care...). Even if we take
just the name 'boolean algebra' it means it used for calculations, which
means it is number not falsehood... After all it used for all these
logical operators which operate with numbers not falsehood... If we say
it is not calculations and it is logical operations, well it is not,
else it would be only true, false, if a to b is false and c to b is true
then a to c is ... this kind of stuff. But it is actually used for
numbers and calculations, because 01101010<<0202 is not logic anymore it
is mathematics which is also logic but other kind than true/false, logic
for the quantity of things not their rightness...
And one more thing. If it is falsehood indeed, then it is something
abstract. Technically speaking True and False have any meaning only in
the context of each other, i.e. in the context of some logic, system or
whatever, not in the context of numbers. So how are you going to convert
from number to falsehood? This would limit us to writing only bool
a=true || bool a=false, which seems annoying to me. bool a=1 is shorter
;]. Plus there will be no if(a), if(b), because a is always true or
always false by itself, it should relate to something else to be right
or wrong, so we will always have to write if(a==1), if(b==null) instead,
so I like it this way ;]
Am I talking nonsese? :)
More information about the Digitalmars-d-announce
mailing list