Random string samples & unicode
Steven Schveighoffer
schveiguy at yahoo.com
Mon Sep 13 07:20:01 PDT 2010
On Sat, 11 Sep 2010 13:20:25 -0400, bearophile <bearophileHUGS at lycos.com>
wrote:
> Andrei Alexandrescu:
>> You can't concatenate two integrals.
>
> The compiler has full type information, so what's wrong in concatenating
> two char or two dchar into a string or dstring?
It's ambiguous also:
string s1 = "abc", s2 = "def";
auto x = s1 ~ s2;
would you expect x to be "abcdef" or ["abc", "def"]?
Essentially, one of the arguments to concatenation must be an array type
in order to avoid ambiguity.
Fortunately, you can get the results you wish with the bracket notation:
auto x = [s1, s2];
-Steve
More information about the Digitalmars-d
mailing list