Copy constructor in D. Why it is necessary to have it.
Sean Kelly
sean at invisibleduck.org
Wed Oct 1 10:23:40 PDT 2008
bearophile wrote:
> Walter Bright:
>> We've been informally calling it "deepdup". The advantage of that is it
>> is fairly hard to misinterpret. Nobody liked my ".dupofearl" idea.
>
> I agree that given the "dup", then then meaning of "deepdup" can be understood much better than "clone".
Everyone has a different opinion :-)
> On the other hand there are some name changes that can improve D2:
> 1) invariant => immutable
Seconded.
> 2) .length => .size
No. To me, 'size' should return the number of bytes of something, not
the number of elements. 'length' is appropriate for what's being returned.
> 3) .dup => .copy
.dup is fine as is, and I think it should always perform a deep copy.
With D going the direction it is, shallow copies are of limited use and
can therefore be called .shallow or something.
> 4) .deepdup => deepcopy
Invalid, assuming #3 above.
Sean
More information about the Digitalmars-d
mailing list