On Wednesday, 19 April 2017 at 14:50:38 UTC, Stanislav Blinov wrote:
Because integrals implicitly convert to characters of same width (byte -> char, short -> wchar, int -> dchar).

Despite char.min > byte.min, char.max < byte.max. Anyway, appending an integer is inconsistent because concatenation is not allowed:

        int n;
        string s;
        s = "" ~ n; //error
        s ~= n; // ok!

This is the same for dchar instead of int.

This is also a problem for overloading:

alias foo = (char c) => 1;
alias foo = (int i) => 4;

static assert(foo(7) == 4); // fails

I would like to see some small changes to mitigate against things like this, even if we can't agree to prevent the conversion overall. It would be nice if we filed a bug as a rallying point for ideas on this issue.

Reply via email to