Fix issue 9999,10560 - Deprecate the implicit int to bool conversion for integer literals#6404
Fix issue 9999,10560 - Deprecate the implicit int to bool conversion for integer literals#6404LemonBoy wants to merge 2 commits intodlang:masterfrom LemonBoy:b9999
Conversation
|
|
s/Removed/Deprecated/ |
|
IMO the deprecation phase is long overdue heh |
Sadly this approach doesn't scale. The reason we have this policy about deprecation is to keep a sane ecosystem package. More than often, you find a library that will only compile with a specific version of DMD, because someone felt a deprecation was not necessary for this specific case. The "fix your code" approach does not scale either: often libraries have dependencies, which might not be compatible with the same frontend. You might also be blocked from updating because of a compiler regression. In general, we should never force working code to be changed if there is a simple deprecation path, and there is one here.
We don't currently have timeline for removal for any of the other deprecations. But it will be a couple of releases for sure. |
|
Alright, you have a point, the only price to pay is having to show the deprecation warning twice but I don't think that's a dealbreaker here. |
|
@LemonBoy do you have a compelling argument to deprecate this. |
|
The two Bugzilla issues referenced in the title contain enough examples of how this (mis)feature gives you a WTF moment. |
|
|
We could fix that without deprecating the implicit cast. |
|
Mmh, definitely yes for making that an ambiguous overload, but not too convinced of deprecating |
|
I see your point but I also think that conflating the integral types and |
|
Changing just the overload rules was the original idea from bugzilla, but the initial pull: got closed to "drop implicit int literal to bool conversion instead". |
|
Revived at #7310. |
As stated by @MartinNowak in #1942 the implicit conversion from
inttoboolshould be removed and today, 4 years later.A single PR to phobos [1] and one to DRuntime [2] are needed.
[1] dlang/phobos#5019
[2] dlang/druntime#1732