On 12/24/2011 05:02 PM, Derek wrote:
On Sun, 25 Dec 2011 02:50:15 +1100, Timon Gehr <[email protected]> wrote:

Although BOOL is typed as 'int', it really has the semantics of 'bool'.
We have an example of this in D1's opEquals().
I think this is reason why implicit conversion bool -> int exists.

It exists because it is handy and makes sense. Would you also want to
ban implicit short -> int conversion?

A 'short' is a type of integer, an 'int' is a type of integer, but a
'bool' is NOT a type of integer.

One can do arithmetic with two integers

If so, then 'short' is not a type of integer.

but what does 'TRUTH * TRUTH'
mean? Or what does 'FALSEHOOD - TRUTH' mean?


TRUTH and FALSEHOOD are in my understanding not values, so performing operations on them is nonsensical.

Having the symbols {0, 1} as the boolean values is a common convention, even outside programming language implementations or computer science/digital design. So TRUE * TRUE = 1*1 = 1 and FALSE - TRUE = 0 - 1 = -1 makes sense.

Reply via email to