Andrea Giammarchi (2013-04-14T17:07:34.000Z)
github at esdiscuss.org (2013-07-12T02:26:59.448Z)
OK, maybe just code was a non-sense ... So, the idea behind is mark a function explicitly as mixin ... how ? Any function that is passed and has an empty prototype (then is user defined or native) could be considered invocable as mixin. ```js function addFunctionality() { this.method = function () { // now the outer context has a method }; } // mark the prototype as empty in ES5 delete addFunctionality.prototype.constructor; function MyClass() {} Object.mixin(MyClass.prototype, addFunctionality); ``` rather than only ```js Object.mixin(MyClass.prototype, {method: function () {}}); ``` If the prototype has at least one own property in its prototype it will be considered a constructor so that: ```js Object.mixin(MyClass.prototype, MySuperClass); ``` can easily be transformed implicitly into: ```js Object.mixin(MyClass.prototype, MySuperClass.prototype); ``` This case is, however, less important, the fact `Object.mixin` should be able to accept a function and invoke it with target as context with optional arguments would be really a **great idea**, IMHO