Re: Non-immutable char[] doesn't change?

2012-08-18 Thread Maxim Fomin
On Saturday, 18 August 2012 at 11:35:59 UTC, Salih Dincer wrote: So, that's not this a bug? char[] a = [ 'a', 'b', 'c' ]; char[] b = cast(char[])"abc"; assert(a == b); /* no problem! */ assert(typeid(a) == typeid(b));/* no problem! */ // v--- TOGGLE CODE //a[0] = '

Re: Non-immutable char[] doesn't change?

2012-08-18 Thread Timon Gehr
On 08/18/2012 02:15 PM, Salih Dincer wrote: This may be the solution...:) char[] b = cast(char[])"abc".dup; // ok, unique reference Sorry... You don't need the cast in this case. Topic: It is not a bug, but it might be surprising because the behaviour of typeid is different with polymorphic

Re: Non-immutable char[] doesn't change?

2012-08-18 Thread Salih Dincer
This may be the solution...:) char[] b = cast(char[])"abc".dup; // ok, unique reference Sorry...

Non-immutable char[] doesn't change?

2012-08-18 Thread Salih Dincer
So, that's not this a bug? char[] a = [ 'a', 'b', 'c' ]; char[] b = cast(char[])"abc"; assert(a == b); /* no problem! */ assert(typeid(a) == typeid(b));/* no problem! */ // v--- TOGGLE CODE //a[0] = 'A'; /* b[0] = 'A'; /* there is problem: