On Wed, 12 Oct 2011 09:46:57 -0400, Trass3r <u...@known.com> wrote:

I believe that the primary reasoning for allowing the implicit conversion
between int and dchar is so that code like this

dchar c = 'a' + 7;

That's a '+' though, not a '~'.

Jonathan meant this better example ;)

string s = "hello";
s ~= 'a' + 7;

I think it shouldn't be allowed with ~ since it's misleading.
Newbies would probably expect "abc" ~ 10 to yield "abc10" rather than the odd "abc\n".

100% agree. Requiring a cast in order to convert to dchar is a small price to pay (not that common to do arithmetic with characters) for avoiding surprising compilations.

-Steve

Reply via email to