D array expansion and non-deterministic re-allocation

Bartosz Milewski bartosz-nospam at relisoft.com
Wed Nov 18 11:03:11 PST 2009


Andrei Alexandrescu Wrote:


> One thing that Bartosz didn't mention is that "this unique" is different 
> than "the other unique", which I think reveals the half-bakedness of the 
> proposal. "The other unique" that was intensively discussed before is 
> transitive, meaning that the root reference points to a graph of objects 
> having no other connection to the outer world. "This unique" is very 
> different because it's shallow - only the array chunk is unaliased, but 
> the members of the array don't need to be. This is a very important 
> distinction.

Actually I was thinking of deep unique, but understandably I neither described full details of my proposal, nor have I completely "baked" it, which would require some serious work and a lot more discussion. One of these days I will blog about uniqueness in more detail.

The problem of transitivity with respect to arrays has been discussed before in the context of const and immutable. We realized that shallow constness/immutability would be useful in some scenarios but, because of the added complexity, we punted it. My feeling is that, similarly, in most cases the restriction that a unique array may only hold unique objects is not unreasonable.




More information about the Digitalmars-d mailing list