Traits - current state of discussion

Mark S. Miller erights at google.com
Fri Sep 21 06:29:43 PDT 2012


The traits.js library is in great shape <http://traitsjs.org>. The traits
semantics it implements is wonderful <
http://soft.vub.ac.be/Publications/2011/vub-soft-tr-11-15.pdf>, and has
been made precise. However, without platform support it suffers from,
arguably, four problems:
* performance -- as with the objects-as-closure pattern which it
generalizes, traits.js costs an allocation per method per instance.
* notation -- as a library, it lacks the syntactic affordances that similar
abstraction mechanisms, like the upcoming minimal classes, are expected to
provide.
* conflict detection -- it would be nice to catch unresolved conflicts
earlier than instantiation.
* impedance mismatch with classes.

The reason we've adopted the minimal classes proposal into ES6 is to adopt
only the agreed intersection of the various things people wanted classes to
do, leaving room to grow back into all sorts of missing functionality post
ES6. Traceur is an excellent vehicle to explore such extended classes
experiments. If you wish to try growing classes back towards supporting
traits, I suggest looking at
http://wiki.ecmascript.org/doku.php?id=strawman:classes_with_trait_composition
http://wiki.ecmascript.org/doku.php?id=strawman:trait_composition_for_classes
and
http://wiki.ecmascript.org/doku.php?id=strawman:syntax_for_efficient_traits

Note that none of these have been reworked to be consistent with the
current ES6 minimal classes design.


On Fri, Sep 21, 2012 at 8:19 AM, Aron Homberg <info at aron-homberg.de> wrote:

> Hi all,
>
> please excuse me if this post is misleading - I'm new to this mailing list.
>
> After implementing getter / setter methods (valid ES3 cross compile
> generator output) for classes in traceur-compiler
> I'm thinking about implementing traits. Therefore I'd like to know the
> current state of your discussions regarding how traits should look like. [1]
>
> Does the strawman/traits_semantics document reflect the recent common
> understanding how traits should be implemented?
> I'm asking because the Traceur wiki says: "Traits have been removed to
> pave way for a class proposal everyone can agree upon." [2]
>
> [1] http://wiki.ecmascript.org/doku.php?id=strawman:traits_semantics
> [2] http://code.google.com/p/traceur-compiler/wiki/LanguageFeatures#Traits
>
> Thank you and kind regards,
> Aron
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>


-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120921/22e9b999/attachment.html>


More information about the es-discuss mailing list