Object.mixin, why just for enumerables (?)
andre.bargull at udo.edu
Thu Oct 3 06:26:51 PDT 2013
> Object.mixin, why just for enumerables (?)
It's a copy-paste error in the draft:
> This is related to:
> In a spec we have both Object.assign and Object.mixin.
> Object.assign is for copying properties ES3 way, which even in ES5 world is
> what you want in most cases (btw. I don't agree with
> For 3 years I work strictly with ES5, and I never had a case in which I
> wanted to just copy enumerables and preserve getters, it's highly unwanted
> in all cases I had).
> Object.mixin is for copying definitions, which I find as rare but also valid
> use case, e.g. to mimic multiple inheritance by copying properties from one
> prototype to other. However this cannot work as intended if it's limited
> just for enumerables. All properties in native prototypes are already
> defined as not enumerable, and this is also what I follow in my code when I
> define models.
> So as specified currently I find Object.mixin as a function that I don't
> find valid use case for, and I strongly miss something like
> Object.assignDefinitions, which will copy properties by descriptors, no
> matter whether they're enumerable or not.
More information about the es-discuss