array append result type
monarch_dodra via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Oct 6 04:40:46 PDT 2014
On Monday, 6 October 2014 at 11:28:16 UTC, John Colvin wrote:
> string a;
> char[] b;
> pragma(msg, typeof(a ~ b)); // char[]
>
> why not string?
>
> What are the rules that determine this?
*Ideally*, I'd have said "it returns char[], so that you can
chose via purity".
However, it's not pure, so that argument doesn't hold.
That said, casting to immutable is safe provided you never
actually mutate. The reverse isn't true.
To answer the question directly though, I don't know what the
rules are. I'd guess they are mostly "whatever druntime
implemented" though...
More information about the Digitalmars-d-learn
mailing list