Why does intpromote spew warnings for ~ operator?

Steven Schveighoffer schveiguy at gmail.com
Mon Sep 13 18:05:39 UTC 2021


On 9/13/21 1:54 PM, H. S. Teoh wrote:
> On Mon, Sep 13, 2021 at 01:49:25PM -0400, Steven Schveighoffer via Digitalmars-d wrote:
>> On 9/13/21 11:38 AM, H. S. Teoh wrote:
>>> On Sun, Sep 12, 2021 at 10:14:03AM -0400, Steven Schveighoffer via Digitalmars-d wrote:
>>> [...]
>>>> ```
>>>> onlineapp.d(11): Deprecation: integral promotion not done for `~x`, use
>>>> '-preview=intpromote' switch or `~cast(int)(x)`
>>>> onlineapp.d(11): Deprecation: integral promotion not done for `~x`, use
>>>> '-preview=intpromote' switch or `~cast(int)(x)`
>>>> Number of affected cases: 0
>>>> ```
>>> [...]
>>>
>>> The integer promotion situation in D is a mess.  My personal
>>> preference is:
>>>
>>> --------
>>> module nopromote;
>>
>> Sure, just like *everyone* uses std.utf.byCodeUnit to avoid
>> autodecoding, right?
> [...]
> 
> It's a solution (or half-solution hack) that works today, as opposed to
> a wishful solution that may or may not happen in the future, if ever.
> 

We have intpromote queued to go into the language. But it's even worse 
than the current status quo.

If we are going to change the rules, we might as well change them to be 
better (at least do what the user expects). That's all I'm saying. We 
don't need more hacks that almost nobody will use.

Sorry to be blunt, but the problem with such things is that it gives an 
excuse to allow the horror show to continue "if you don't like it, you 
can just use this library!"

-Steve


More information about the Digitalmars-d mailing list