DIP 1015--removal of implicit conversion from integer and character literals to bool--Community Review Round 1

Mike Franklin slavo5150 at yahoo.com
Fri Jun 22 04:33:34 UTC 2018


On Thursday, 21 June 2018 at 17:11:07 UTC, Steven Schveighoffer 
wrote:

> I agree with everything, but one thing that is not specified 
> here is when integers are used as conditionals.
>
> In other words, this still has to compile:
>
> if(1) ...
>
> enum a = 1;
>
> if(a) ...

Although I would prefer it if such code was not allowed without a 
cast, it is out of scope of this DIP.

I've added a test to the implementation at 
https://github.com/dlang/dmd/pull/7310/files#diff-d14bf83f29923ca109a2e5315174791a to ensure it doesn't break, and updated the DIP to clarify at https://github.com/dlang/DIPs/pull/127/files.

Thanks for the feedback.

Mike




More information about the Digitalmars-d mailing list