On 10/13/2011 05:29 PM, Nick Sabalausky wrote:
"Don"<[email protected]>  wrote in message
news:[email protected]...

The problem is things like:
int i;
string s = "0x" ~ ('0' + x);
since char + int -->  int.


1. Maybe it would be better to have "char + int -->  char"? Sounds much more
sensible to me, although I haven't thought too much about it. When do you
ever add a number to a code unit and *not* expect to end up with another
code unit?

int i = 0;

foreach(c; somesrting) {
  i = i * 10;
  i = i + c;
}


2. I see nothing wrong with needing an explicit cast when going from int to
char, even in that example. What we have now is a teeny, tiny, minor, minor,
minor convenience for some not-particularly-common situations. And the cost
for that negligable benefit is shit like this: "I have "~count~" apples" //
Ka-boom  --  I want a compile error on shit like that (heck, even an
implicit to!string would at least be an improvement over what it does now).


Reply via email to