1 matches bool, 2 matches long

Rob T alanb at ucora.com
Fri Apr 26 07:28:58 PDT 2013


On Friday, 26 April 2013 at 08:03:14 UTC, Walter Bright wrote:
> On 4/25/2013 11:16 PM, deadalnix wrote:
>> This "feature" never has been useful to me.
>
> It has been useful to me. So there!
>

If you want an int to behave like a bool, then by all means go 
ahead and write the code yourself, I don't want the compiler to 
do it for me in a silent manner.

>> It has caused bug.
>
> The bug is not providing an overload for int.
>

That kind of nonintuitive requirement is easily overlooked.

>> Additionally, the behavior is inconsistent :
>>
>> int i = 1;
>> foo(i); // Don't call the bool version.
>
> It is not inconsistent - you forgot a foo(int) overload. '1' is 
> an int. If you don't supply and int overload, it must 
> implicitly convert, and those conversions are considered 
> equivalent.

Seriously, let's fix this once and for all. Bool is bool, it's 
not int and never should have been. I don't understand why we're 
having this debate.

--rt


More information about the Digitalmars-d mailing list