Constructors (starstruck noob from C++)

Robert Jacques sandford at jhu.edu
Fri Jan 21 08:27:34 PST 2011


On Fri, 21 Jan 2011 08:16:24 -0500, spir <denis.spir at gmail.com> wrote:

> 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
>

".dup" comes from arrays, which already have a ".dup" property which  
copies/clones them.


More information about the Digitalmars-d mailing list