Copy constructor in D. Why it is necessary to have it.
Steven Schveighoffer
schveiguy at yahoo.com
Wed Oct 1 06:45:52 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".
>
> On the other hand there are some name changes that can improve D2:
> 1) invariant => immutable
Yes
> 2) .length => .size
No. Size can imply the memory size, so an array of ints, I might expect
size to return 4*length.
> 3) .dup => .copy
either works for me.
> 4) .deepdup => deepcopy
either works for me.
> 3) "dup" is used quite commonly, so it deserves a short name, but "copy"
> is just one character longer, it isn't an abbreviation, and it's more
> readable, so I think it's not bad.
character length is not as important as clarity, but dup seems pretty clear
to me. If it were copy vs. duplicate, I'd go with copy for brevity, but
either is fine.
-Steve
More information about the Digitalmars-d
mailing list