Thanks for the inspiration!
Download opened this issue · comments
Stijn de Witt commented
I read your blog post and browsed this repo and it is amazing stuff you have here!
I got really inspired by your work so I ran with it and created this library, loosely based on mixwith:
mics
It looks a lot like yours with some (big) differences:
- I merged
mix
andmixin
into one with
is optional syntax sugarmix
can return a mixin instead of a class- mixins can be used to instantiate an object directly
mix
can combine multiple mixins into a new one
I found that creating an actual class is often not desirable because it limits the potential uses for the code. Instead, mics promotes the use of mixins everywhere:
import { mix, is } from 'mics'
var Looker = mix(superclass => class Looker extends superclass {
look() {
console.info('Looking good!')
}
})
// directly instantiate a looker:
var looker = new Looker()
looker.look()
Thanks again for inspiring me and I'd love to get some feedback from the master!