string concatenation

Ellery Newcomer ellery-newcomer at utulsa.edu
Wed Nov 18 19:26:29 PST 2009


Andrei Alexandrescu wrote:
> TDPL boasts the code:
> 
> void main()
> {
>   string a = "Hall\u00E5";
>   wstring b = ", ";
>   dstring c = "V\u00E4rld";
>   auto d = b ~ c;           // d has type wstring, same as b
>   a ~= d ~ '!';             // concatenate string with character
>   writeln(a);
> }
> 
> We are having second thoughts about allowing b ~ c. It may be just a bit
> too clever. Also, figuring out the result type is not a slam dunk. The
> pro arguments are that strings are already supported by the compiler in
> iteration, literals, and concatenation of a char[] with a dchar.
> 
> What say you?
> 
> 
> Andrei

What are the current ideas on result type and why don't they dunk?

(personally, I like the idea of a syntax for converting from one unicode
representation to another)



More information about the Digitalmars-d mailing list