D array expansion and non-deterministic re-allocation
Bartosz Milewski
bartosz-nospam at relisoft.com
Tue Nov 24 00:47:33 PST 2009
Andrei Alexandrescu Wrote:
> sharing for ~=. Also I am not ruling out the possibility that we can
> guarantee a ~= that never keeps sharing with existing arrays. (One idea
> I discussed with Walter was encoding uniqueness of arrays in a bit
> stored with the array limits.)
I've been thinking the same. Full uniqueness might be hard to implement, but if you are only interested in "opportunistic uniqueness" as an optimization tool, that might be easier. In full uniqueness you worry about lending and deep aliases. Here you might just conservatively decide that passing an array to a function, or storing it in an object, destroys its uniqueness (on top of explicit slicing). And you don't have to care about deep aliases as long as your only interest is in the uniqueness of the array buffer and not the objects it might be storing. Uniqueness one way or another is the key.
More information about the Digitalmars-d
mailing list