Constructors (starstruck noob from C++)

spir denis.spir at gmail.com
Fri Jan 21 05:16:24 PST 2011


On 01/21/2011 06:28 AM, Robert Jacques wrote:
> void copyMembers(A)(A src, A tgt) if (is(A == class)) { tgt.tupleof =
> src.tupleof; }

What about this feature in Object under name "copy" or "dup"? Sure, it's 
not to be used evereday; but it's typcally the kind of routine that, 
when needed, we're very happy to find. And as shown by this thread the 
solution is clearly non-obvious (lol).

By the way, why "dup" in D, instead of most common "copy" or "clone"? Is 
it also a legacy name? (Don't tell me we got this one from stack-based 
languages like Forth ;-) Anyway the semantics are totally different (*)).

Denis

(*) for very curious people: concatenative languages: 
http://concatenative.org/wiki/view/Concatenative%20language
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list