DMD 0.148 release

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Sun Feb 26 15:41:35 PST 2006


Georg Wrede wrote:
> Ivan Senji wrote:
> 
>> Georg Wrede wrote:
>>
>>> Derek Parnell wrote:
>>>
>>>> On Mon, 27 Feb 2006 06:05:13 +1100, Georg Wrede <georg at nospam.org> 
>>>> wrote:
>>>
>>>
>>>>> We've all had our fights with C, C++, and other related languages. 
>>>>> But  honestly, how many of us can confess to having problems with 
>>>>> logical  values?
>>>>
>>>> Me.
>>>>
>>>>> And if someone here has such problems, I suggest switching to VB.
>>>>
>>>>
>>>>
>>>>
>>>> I am also a VB coder and I'm not a language bigot.
>>>
>>>
>>>
>>>
>>> Oh. I'm sorry. I'll try not to mention VB in the future.
>>>
>>> ---
>>>
>>> I think we've gotten it backwards here, so let's turn the table:
>>>
>>> Can you give some example code and use cases where we absolutely need 
>>> your kind of booleans?

Could it be that I missunderstood you? By your kind of booleans did you 
mean the true non-integer booleans? If so, that is what the example dow 
there is for: showing why we need real bools.

And if I did missunderstand something I apologize (it's late).

>>
>>
>>
>> Ok, I'll give an example of that right after you give an example of 
>> why and where this is needed/good/(not extremly bad):
>>
>>   bool a, b, c;
>>   a = true;
>>   b = true;
>>   c = true;
>>
>>   a = b+c; // true + true is what?
> 
> That's why we do want to have booleans. The whole point of having 
> booleans is to not do that by mistake.

Are you now saying you want real booleans that are not ints?

> 
>>   if(5) //if 5 what? what does that mean (except nothing)?
> 
> 
> Ever seen this:
> 
> while(1)

I sure did, and it scares the hell out of me :)

> 
> written in source code?
> 
> Or this:
> 
> c = getCharacter(inf);
> if (c) { /* whatever */ }

...even worse :)

> 
> 
> Oh, by the way, just checked how many times 'while(1)' appears in 
> src/phobos/std:
> 
> grep "while *( *1 *)" *.d |wc
> 
> answer: 16 times.
> 

Scary.

> ---
> 
> Now, let's see your promised example.

My example was supposed to be an example for:
a) real bools being needed
b) int bool being bad



More information about the Digitalmars-d-announce mailing list