A few more thoughts...

On Nov 13, 2011, at 5:08 AM, Jake Verbaten <rayn...@gmail.com> wrote:

> 
> 
> Neither of them are fit for standardization. Selfish and Prototype are both 
> incapable of correctly "deep copying" arrays or objects,
> 
> Why does it matter that they don't deep copy? Deep copying is a difficult 
> problem that needs to be standardized separately. I've personally avoided 
> deep copying for this reason and don't use it anymore.
> 
> One can accept that an extend is merely a shallow copy properties by 
> reference, because this (although limited) behavior is easy to understand. 

Shallow copy is only good for one level of property lists whose assignment 
expressions are all primitive, anything that is a reference is going to allow 
the destination to mutate the source, this is wrong. 

> 
> I have a version of Object.extend that is a "shallow own merge".
> 
> However having a deep copy mechanism that works without obscure edge-cases 
> would be great.

Can you be specific? What obscure edge cases have you previously encountered?

> Of course it would be nice if we had the choice of deep vs shallow copy 
> within the API.

Agreed
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to