Object.mixin( source, target ) | arguments changed

Brendan Eich brendan at mozilla.com
Thu Jun 13 08:52:08 PDT 2013


A real brain-bender for all those "extend" workalike users.

LHS, RHS assignment-expression order is best (Moto 68K vs. Intel 808x 
asm wars; also gdb vs. binutils IIRC).

The lack of extensibility (or should we allow multiple sources now?) is 
the killer for me.

/be

Tobias Buschor wrote:
> I propose to change the arguments.
>
> The second argument "target" is optional and default to 
> "Object.create(null)"
> The return-value is the modified target
>
> Advantages:
>  - Without the second argument, we can copy the source
>  - It is more natural to say "mixin the source into the target" => 
> misin.(source, target)
>
> Disadvantages
>  - Its not suitable to extend the function to accept multiple sources 
> in the future
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss


More information about the es-discuss mailing list