Definition mixins

Isiah Meadows isiahmeadows at gmail.com
Mon Nov 13 14:48:40 UTC 2017


May I point out a few things:

1. The React community, who has for most of its existence used mixins and
pseudo-proxies (they call them 'higher order components", but they're
basically component proxies) is now moving to this thing called a "render
prop", which is basically a function argument returning children. This is
because mixins don't compose nor scale.

2. Elm, a compile-to-JS language/front-end framework (it's both), separates
the model from the view, and the view is a function from model to vnode
tree. When you use a child component, you store the child's model in the
parent model, and you pass that state to the child's view when rendering
the parent's view. There exist JS microframeworks that implement this flow
for JS as well.

3. It's common practice in Angular to use dependency injection and
directives where most others would use mixins. Angular dropped mixin
support because of similar scalability issues.

The whole point of these examples is to state that mixins aren't critical
enough to be added to the language. It's perfectly fine as a library, but
it's not something we should include in the language.

-----

Oh, and fun fact, some languages, like Elm and Haskell, don't even provide
means for creating mixins, even through interfaces. Instead, they use
functions exclusively to define extended functionality.

On Mon, Nov 13, 2017, 07:25 Raul-Sebastian Mihăilă <raul.mihaila at gmail.com>
wrote:

> The first version is based a hundred percent on concepts and mechanisms
> already used in Ecma262. (Looks like esdiscuss.org has an issue with
> percentages).
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20171113/c9cd413b/attachment.html>


More information about the es-discuss mailing list