On Fri, Dec 23, 2005 at 04:16:44PM +0000, Luke Palmer wrote:
> Does .clone do deep or shallow copying of objects?
> 
> I'm going to argue for shallow.  I know there's a obvious tendency to
> say that we should go with deep, because it's useful sometimes. 
> However, I think that would be ignoring the amazing prevelance of the
> shallow copy idioms in perl 5:
> 
>     [ @array ]
>     { %hash }
> 
> We could consider .clone to be the natural extension of this (and have
> the above forms be its definition for Array and Hash).

Why not call the shallow copy .copy, and the deep copy .clone?

Nicholas Clark

Reply via email to