[Issue 12595] dup/idup shouldn't be property functions

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Apr 26 09:49:04 PDT 2014


https://issues.dlang.org/show_bug.cgi?id=12595

JR <zorael at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zorael at gmail.com

--- Comment #2 from JR <zorael at gmail.com> ---
It's semantically ambiguous as duplicate can be both a noun and a verb.

I tend to think of .{i,}dup the noun way; something.duplicateOf; where whether
the .duplicateOf property "does" something or not remains up to implementation.

In abstract: the clerk has a stack of foos and you're asking for a .dup copy,
so he fetches one from the pile and hands it to you.

The opposite is naturally .duplicateThisForMe, from which perspective they
shouldn't be property functions, no.

--


More information about the Digitalmars-d-bugs mailing list