|
From: Brian C. <B.C...@po...> - 2003-08-05 14:43:59
|
On Tue, Aug 05, 2003 at 11:35:19PM +0900, ts wrote:
> >>>>> "B" == Brian Candler <B.C...@po...> writes:
>
> B> def clone
> B> clone_with(@arr.dup)
> B> end
>
> alias dup clone
alias :dup :clone
OK that works... thank you.
I assume that for 'dup' and 'clone', one used to be implemented in terms of
the other. Is there a comparison of these two methods anywhere? In the
Pickaxe it says:
"dup typically uses the class of the descendent object to create
the new instance"
But I'm not quite sure what that means. Is it saying that typically Foo#dup
is implemented by calling Foo.new (or self.class.new) ?
Cheers,
Brian.
|