Minimalist (why) classes ?

Axel Rauschmayer axel at rauschma.de
Sun Nov 13 02:36:58 PST 2011


It depends on what kind of `extends` you mean:

- Inheritance: Even though data being kept in prototypes is rare, it’s usually better to chain prototypes even when ignoring aliasing problems (no redundant properties, instanceof works transitively). Performance degradation should be negligible due to internal optimizations.

- Merging objects: Shallow copy is the way to go.

On Nov 13, 2011, at 11:08 , Jake Verbaten 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. 
> 
> 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. Of course it would be nice if we had the choice of deep vs shallow copy within the API.
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111113/4dc475c2/attachment-0001.html>


More information about the es-discuss mailing list