Constructors (starstruck noob from C++)
spir
denis.spir at gmail.com
Fri Jan 21 11:54:53 PST 2011
On 01/21/2011 05:27 PM, Robert Jacques wrote:
> 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.
Yes. I was in fact (unclearly) wondering where .dup for arrays comes
from. I mean, the obvious term --and short enough to not even look for
an abbreviation possibly making it obscure-- is "copy", isn't it? (*)
Denis
_________________
vita es estrany
spir.wikidot.com
(*)
Or do people really speak like:
<< Would you please make a duplicate of the guest list? >>
in the US?
More information about the Digitalmars-d
mailing list