int/longRe: DIP 1015--removal of integer & character literal conversion to bool--Final Review

Steven Schveighoffer schveiguy at gmail.com
Sun Sep 16 17:33:27 UTC 2018


On 9/15/18 8:36 PM, Nicholas Wilson wrote:

> Without it, I get a (possibly quite a lot of) deprecation warnings and I 
> have to insert a cast to the corresponding type, e.g. 
> f(cast(int)E.a)/g(cast(long)(a - b)), to verify the behaviour under the 
> new system and silence the deprecation warning (absolutely necessary if 
> using `-de`). Then I have to delete them after stage 2, but what if I 
> want to support older compilers? Well then I have to wait until they are 
> sufficiently old enough.
> 

As precedent, we do have -transition=intpromote, which disables the 
requirement for casting smaller integers to int first.

So the way I would expect someone to migrate their project:

1. Examine all deprecations, looking for ones where I actually *WANT* 
the bool version to be called. Insert cast there.
2. Enable the -transition=nobooldemote or whatever we call it.
3. Once the deprecation period is over, remove the -transition switch.

If I wanted a version to be compilable with older versions of dmd, then 
I would have to cast.

Hm... another option is to have a switch identify "useless" casts once 
the deprecation period is over. Or add it into dfix.

-Steve


More information about the Digitalmars-d mailing list