D array expansion and non-deterministic re-allocation
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sun Nov 22 16:58:37 PST 2009
Bartosz Milewski wrote:
> Ali Cehreli Wrote:
>
>> Neither 'a' nor 'b' own the elements; in that sense, if one is a
>> slice then the other is a slice... In D, slices have "discretionary
>> sharing semantics." Any slice may leave the sharing contract as it
>> sees unfit.
>
> So is your answer different from that of dsimcha? I'm sitting on a
> fence about it. Andrei, could you settle this issue (and a few others
> I raised before)?
I'm not sure I figure what the issue is, and I'd appreciate a rehash of
the few other issues brought up. (I thought they had been responded to.)
David's reply is valid but may be a bit misleading because it explains
things in terms of the cache, which could reinforce the impression that
the cache is part of the definition.
Ali's point is also correct in the sense that arrays are not owned.
Garbage collection makes that possible.
It's very simple, really. Appending to an array never results in
overwriting elements of an existing array. Appending may terminate a
sharing relationship. This is simple, easy to understand, and requires
no understanding of the optimization paraphernalia, which I hope to be
able to improve.
Andrei
More information about the Digitalmars-d
mailing list