Traits/Mixins for class syntax

Allen Wirfs-Brock allen at wirfs-brock.com
Mon May 20 14:42:59 PDT 2013


On May 16, 2013, at 5:11 PM, Dmitry Soshnikov wrote:

> Hey guys,
> 
> Sorry for the random question (probably it was already discussed).
> 
> What is a current state having mixins/traits syntax along with a class definition?

They aren't part of ES6.  There have been past discussions about mixin support and they could be considered for a future edition

> 
> Like:
> 
> class Foo extends Bar {
>  use EventEmitter, CommonMethodsMixin;
>  ...
> }

having you considered in ES6 exploiting the fact that what follow etends is an expression:

class Foo extends mixin(Bar, EventEmitter,CommonMethodsMixin) {
  ...
}

Allen





More information about the es-discuss mailing list