Deprecate implicit conversion between signed and unsigned integers

Dom DiSc dominikus at scherkl.de
Thu Feb 6 11:07:06 UTC 2025


On Monday, 3 February 2025 at 18:40:20 UTC, Atila Neves wrote:
> https://forum.dlang.org/post/pbhjffbxdqpdwtmcbikh@forum.dlang.org
>
> On Sunday, 12 May 2024 at 13:32:36 UTC, Paul Backus wrote:
>> D inherited these implicit conversions from C and C++, where 
>> they are widely regarded as a source of bugs.
>>
>> [...]
>
> My bias is to not like any implicit conversions of any kind, 
> but I'm not sure I can convince Walter of that.

I think most of the problems with these implicit conversions 
would be gone if we make this work:

```d
    byte a= -5;
    ulong b = 1_000_000_000_000;
    assert(a < b); // fails
```

And we already do have a solution for this (see 
https://issues.dlang.org/show_bug.cgi?id=259), but Walter refuses 
it, because it will break code that relies on this bug.
How much less likely is it to convince him of your proposal?


More information about the dip.ideas mailing list