T[new] misgivings

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Oct 16 07:30:24 PDT 2009


Lutger wrote:
> Just to understand it:
> 
> int[new] a;
> int[new] b;
> 
> a = [1,2,3];
> b = a;
> 
> In your book, the last statement would copy contents of a into b and b.ptr 
> != a.ptr while according to walter, b would rebind to a?

Well no.

In the case above b would rebind to a, which is consistent with:

int[new] a = [1, 2, 3];
void fun(int[new] b) { ... }
fun(a); // does not copy a

I am not concerned about assigning one array to another. I'm more 
concerned about assigning an array literal to an array.


Andrei



More information about the Digitalmars-d mailing list