Object.mixin( source, target ) | arguments changed

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Jun 13 13:49:11 PDT 2013


On Jun 13, 2013, at 10:09 AM, Kevin Smith wrote:

> 
> 
> Based on this and the example shown above, I think it's fair to say that reversing the arguments isn't in the ES6's best interest.
> 
> 
> Definitely.  Reversing the argument order would make for awkward code like this:
> 
>     Object.mixin({
> 
>         a() {},
>         b: 123,
>         c
>     }, target);
> 
> And I agree that we should attempt to find a different name for "mixin", if possible. (although it means I'll have to change my bleeding edge code yet again!)

We went through this once before and considered other names including "define" and "extend" and concluded that "mixin" has the fewest warts.  I'm not sure how useful it is to revisit the names again.

I personally don't see that there is any real conflict between Object.mixin and a hypothetical "mixin" superclass combinator that someone might define in the future. They are distinct functions, that do different (but conceptually somewhat related) things.  It's not obvious to me that Object.mixin would be any more of a source of confusion than "define", "extend", or any other English word that might also be used in other contexts.

Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130613/587dac9f/attachment-0001.html>


More information about the es-discuss mailing list