Object.define ==> Object.mixin??

Andrea Giammarchi andrea.giammarchi at gmail.com
Tue Dec 11 10:37:05 PST 2012


what I think is a very valid use case for mixins based on ES5 features

var MixIt = Object.defineProperties({}, {
  name: {
    enumerable: true,
    get: function () {
      // notify or do stuff
      return this._name;
    },
    set: function (_name) {
      // notify or do stuff
      this._name = _name;
    }
  },
  _name: {
    writable: true
  }
});

while super is unknown concept in ES5 but if de-sugared as
Constructor.prototype.method.call(this, argN) in ES6 then is implicitly
valid/doesn't need to be modified?

br


On Tue, Dec 11, 2012 at 10:29 AM, Rick Waldron <waldron.rick at gmail.com>wrote:

>
>
>
> On Tue, Dec 11, 2012 at 1:27 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:
>
>> >> 2) It needs to rebind super references
>> >> 3) I don't see any reason that it should be restricted to enumerable
>> >> properties. If the intend is to deprecate enumerable along with for-in
>> then
>> >> we should be adding new functionality that is sensitive to the state
>> of the
>> >> enumerable attribute.
>> >
>> > "should not"?
>>
>> Right, should not!
>>
>
> To clarify, I assumed you meant "should not", based on the rationale and
> that is what I was agreeing to.
>
> Rick
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121211/6b14b324/attachment.html>


More information about the es-discuss mailing list