On 24/01/11 23:09, Ellery Newcomer wrote:
in the following:
void main(){
char[] x;
string s;
string y;
y = s ~ x;
}
tok.d(5): Error: cannot implicitly convert expression
(cast(const(char)[])s ~ x) of type char[] to string
why should typeof(s ~ x) == char[] ?
x is a mutable array of mutable chars
s is a mutable array of immutable chars
If you append something mutable to something immutable, the resulting
type must be mutable, as some of the contents is mutable and could be
changed - if that can happen the result can't be immutable. To get
around this there's .idup I believe.
--
Robert
http://octarineparrot.com/