array append result type

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 6 09:38:37 PDT 2014


On 10/6/14 7:28 AM, John Colvin wrote:
> string a;
> char[] b;
> pragma(msg, typeof(a ~ b)); // char[]
>
> why not string?

It really should be whatever you want. a ~ b is going to generate a 
completely unique independent copy of a and b.

> What are the rules that determine this?

Not sure. I would have expected at least one of a ~ b or  b ~ a to be 
string, but both generate char[].

I filed this ER ages ago: https://issues.dlang.org/show_bug.cgi?id=1654

Not sure if anyone has it on their radar at this point.

-Steve


More information about the Digitalmars-d-learn mailing list