On Sunday, 12 November 2017 at 16:57:05 UTC, Andrei Alexandrescu
wrote:
A DIP could be formulated to only address the problem at hand.
BTW, here's a really fun example:
void fun(long) { assert(0); }
void fun(bool) {}
enum int a = 2;
enum int b = 1;
void main()
{
fun(a - b);
}
The overload being called depends on (a) whether a - b can be
computed during compilation or not, and (b) the actual value of
a - b. Clearly a big problem for modular code. This is the
smoking gun motivating the DIP.
As I understand it, the case above can be solved by changing the
overload resolution rules without deprecating the implicit
conversion to bool. A PR for such a fix was submitted here
https://github.com/dlang/dmd/pull/1942.
I fear a proposal to deprecate the implicit conversion to bool
based solely on the example above could be refused in favor of
overload resolution changes. IMO, the example above, while
certainly a smoking gun, is actually just a symptom of the deeper
problem, so I tried to make that case in the DIP.
The DIP has been submitted here
https://github.com/dlang/DIPs/pull/99
Perhaps I'm not the right person to be formulating these
arguments, but given that the issue has been in Bugzilla for 4
years, I'm probably all you've got. Sorry.
Mike