1 matches bool, 2 matches long

eles eles at eles.com
Sun Apr 28 12:38:24 PDT 2013


On Sunday, 28 April 2013 at 19:19:53 UTC, Walter Bright wrote:
> On 4/27/2013 2:58 PM, jerro wrote:
>> On Saturday, 27 April 2013 at 21:52:30 UTC, Walter Bright
> To reiterate, history amply shows that if 'true' and 'false' 
> are not there, then people will define them themselves, 
> inconsistently, and the end result is not helpful to anybody.


So basically, those are to be seen as simple #defines for 0 and 1 
and nothing more than that?

I am for a boolean type that is only true and false.

And, if so much needed conversion from int 0 and int non0 to 
boolean is needed in if() and while(), then simply add ifz(), 
ifnz(), whilez() and whilenz() to the language.

(that is: ifzero(), infnonzero(), whilezero(), whilenonzero()).

This will really convey the intention of the programmer.

Elsewhere, I see no reason to accept implicit cast from bool to 
int, and less so in function overloading.

I am in favor of a true boolean type, nothing to do with 
integers, and of helpers where needed.

Besides, I do not like the idea of a bit type, because of its 
fractional representation (you need to use an entire byte for it, 
and unlike other (integer) types, its maximum range of values 
*does not* completely cover the width of its representation).

I would rather accept a ranged-type that goes from 0 to 1 
(sub-range of integers).

In Pascal that would be:

0..1, with a zero-based index


More information about the Digitalmars-d mailing list