Object.define ==> Object.mixin??

Allen Wirfs-Brock allen at wirfs-brock.com
Tue Dec 11 10:35:05 PST 2012


On Dec 11, 2012, at 10:19 AM, Andrea Giammarchi wrote:

> Agreed, getOwnPropertyNames is way more appropriate if the topic is: use all ES5 features for mixins too.
> 
> Also, the Nicolas example is potentially disaster prone, not in that specific form, but in the way a getter with private scope access could be.
> 
> Imagine many objects using that specific object as mixin with that name getter, if there was a setter too the first one that will use it will overwrite the returned value for all other objects.
> 
> I think propertie swith getters and setters will cause as many headaches as objects and arrays in function prototypes did before already but hey, if you know what you are doing, I believe there's no other solution for "universally capable mixin method"

I had a proposal for creating accessors that would only over-ride half of an inherited get/set pair: http://wiki.ecmascript.org/doku.php?id=harmony:object_initialiser_super#super_in_accessor_property_definitions 

I let it fade away because, 1) it was kind of ugly, and 2) there were other more important things to put energy into.

Allen



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121211/ec241fa5/attachment.html>


More information about the es-discuss mailing list