Copy constructor in D. Why it is necessary to have it.

bearophile bearophileHUGS at lycos.com
Wed Oct 1 04:22:03 PDT 2008


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
2) .length  =>  .size
3) .dup  =>  .copy
4) .deepdup  =>  deepcopy

1 and 2) are surely improvements.

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.

And 4) is just the natural extension of the name 3). It doesn't deserve a very short name because it's not used often, so it's better to make it as readable as possible.

Bye,
bearophile



More information about the Digitalmars-d mailing list