javascript - How to use Mixins for every type of inheritance? -


i've saw concept of mixin in javascript through the article real mixins javascript classes. , understand way multiple inheritance abstract classes , more composition inheritance. i'm reading concept composition on inheritance, in the article composition on inheritance. i'm aware discussion inheritance , composition can long, i've chosen avoid inheritance as can (at least now).

so use mixins as can es6 , in of examples see 3 classes in action class extends mixinb(c). if want extend class b? class extends mixinb(object)? might anti pattern mozilla documentation states.

note direct inheritance class extends b, b not mixin anymore , need different declaration of b if use mixin.

i think solution looking change definition of mixin functions.

instead of having:

mixinb(whateverclass) 

you have:

mixin(mainclass, otherclass1, otherclass2...) 

where true:

mixinb(c) = mixin(b, c) 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -