smart-mix (mixin library)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

smart-mix (mixin library)

Raul-Sebastian Mihăilă
As a follow up on my previous mixin proposal and the discussion at ( I published a mixin library on npm: smart-mix (

- mixes in public methods
- mixes in private methods
- allows sharing private state and public state
- each instance of the mixin has its own state
- avoids keys collisions
- works both with symbols and string keys
- avoids the gorilla-banana problem by getting only the methods you need
- works both in function contexts and class contexts
- you clearly see what your object has mixed in in its definition context
- you clearly see where your mixed in capabilities come from

It's not clear how well the existing TC39 proposal for mixins deals with some of these (especially with sharing private state between your code and the mixin context.

es-discuss mailing list
[hidden email]