>Why does ES even need traits? >The only aspect they can help with here is the type system we don't have yet. > >We have `Object.assign` that works fantastically for most classic trait use >cases.
They’d provide a way to explain WebIDL concepts like partial interfaces and partial dictionaries. That in itself is pretty cool. If traits were extendable and allowed providing default implementations of methods, it would also allow people to polyfill methods of partial interfaces in a much easier fashion, without having to keep track of all the various types that implement the partial interface. That seems like a pretty good reason to make them a “thing”, to me. > On Feb 12, 2015, at 3:08 PM, Benjamin Gruenbaum <[email protected]> wrote: > > Why does ES even need traits? > The only aspect they can help with here is the type system we don't have yet. > > We have `Object.assign` that works fantastically for most classic trait use > cases. > >> On Feb 12, 2015, at 18:35, Andrea Giammarchi <[email protected]> >> wrote: >> >> Without going down full specification/implementation details, does anyone >> believe that classes should/could be used, in the future, as traits/mixins >> too? >> >> I find that an anty pattern. >> >> I think traits should be just plain objects with an initializer or some >> special object flagged as trait and I'd rather leave inheritance and classes >> features outside this future feature. >> >> Thoughts? Thanks! > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

