On Tue, Sep 18, 2012 at 9:20 PM, Yaser Sulaiman <yaserbuntu / gmail.com> wrote:
> Hi.
>
> Is there a community convention that specifies which of the two methods,
> `Object#clone` and `Object#dup`, should be overridden for the purposes of
> deep-cloning?
>
> On Stackoverflow, some say that `clone` should be overridden [1], while
> others say that `dup` is the method to be overridden [2]. So I suspect that
> there isn't such a convention.
>
> [1]: http://stackoverflow.com/a/8529625/1173
> [2]: http://stackoverflow.com/a/11752485/1173

Those answers are not good because in part they are just plain wrong.
There is no community convention either way that I am aware of.

My question for you would be: what do you need deep copying for?  I
often find deep copy is a bit of a cargo cult approach: we simply grab
everything we can get so we are sure it's ours.  I have rarely - if at
all - felt the need for a deep copy; I usually prefer specific
functionality to handle state.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/