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.