Inability to dup/~ for const arrays of class objects
Ali Çehreli
acehreli at yahoo.com
Thu May 30 10:23:52 PDT 2013
On 05/30/2013 10:09 AM, Steven Schveighoffer wrote:
> The major concept difference is ownership. Two references to the same
> array do not mysteriously split when length is extended on one of those
> references. All references to the same array always refer to the same
> array, even when it has to reallocate to extend length. Slices differ
> from this behavior, and I can say with great confidence that this is the
> most confusing aspect of D slices.
>
> In addition, shrinking a dynamic array invalidates any data that has now
> been removed. D slices do not do this either. Because slices simply
> point at data, they don't own it.
I tried to name those semantics by "discretionary sharing semantics":
http://forum.dlang.org/thread/hd2fot$mkc$1@digitalmars.com
I have not read that old post mine again now but I still like the term. :)
Ali
More information about the Digitalmars-d
mailing list