-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mixins to the inherit call? #33
Comments
The order of parameters there would definitely complicate how inherit would detect things (or would be impossible). And usually mixing in is a function call (with parameters potentially). Are you thinking we'd need to have, e.g.: inherit( Object, [ new Poolable( { maxPoolSize: 100 } ) ], Type, {}, {} ); This seems like it would add complications. |
It looks like it would be even more complicated if we have to supply arguments like Poolable.mixInto( Bounds2, {
defaultFactory: function() { return Bounds2.NOTHING.copy(); },
constructorDuplicateFactory: function( pool ) {
return function( minX, minY, maxX, maxY ) {
if ( pool.length ) {
return pool.pop().setMinMax( minX, minY, maxX, maxY );
}
else {
return new Bounds2( minX, minY, maxX, maxY );
}
};
}
} ); Or would those be "abstract" methods that get implemented in the prototype (in the first |
I came across this mixin/inheritance library: https://github.com/rse/aggregation which uses this syntax (es6) class Rectangle extends aggregation(Shape, Colored, ZCoord) {} |
I also noticed ES6 provides mixin support: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes |
Would it simplify our inheritance system or make it easier to read/understand if mixins were specified in the inheritance call?
inherit(Object,[mixins],Type,{},{})
I considered this will working on phetsims/tandem#31
The text was updated successfully, but these errors were encountered: