I noted some open issues on "Classes with Trait Composition"

Mark S. Miller erights at google.com
Tue May 17 20:20:42 PDT 2011

On Sun, May 15, 2011 at 10:01 PM, Brendan Eich <brendan at mozilla.com> wrote:

> http://wiki.ecmascript.org/doku.php?id=strawman:classes_with_trait_composition#open_issues

That wiki page has no had extensive revisions in light of recent discussions
with Brendan, Allen, Dave Herman, and Bob Nystrom. It derives from previous
discussions with Allen, Bob, and Peter Hallam. I have tried to capture here
as best as I could the consensus that has emerged from these discussions.

All this derives from earlier discussions that also included Waldemar, Alex
Russell, Arv, and Tom Van Cutsem. And the experience of the Traceur project
made a significant contribution. This has all had a long history so if I've
left out some key contributors, please let me know, thanks.

> This looks pretty good at a glance, but it's a *lot*, and it's new.

It's much less now! The main effect of all the recent feedback was to find
opportunities to remove things. What remains is mostly just a way to express
the familiar pattern by which JavaScript programmers manually express
class-like semantics using prototypes. The result interoperates in both
directions with such old code: a class can inherit from a traditional
constructor function and vice versa.

> I have to say this reminds me of ES4 classes. That's neither bad nor good,
> but it's not just superficial, as far as I can tell (and I was reading specs
> then and now).

It definitely had an influence. There were many things I liked about ES4

> On the other hand, I'm in no rush to standardize something this complex and
> yet newly strawman-spec'ed and yet unimplemented. So we may as well take our
> time, learn from history, and go around the karmic wheel again for another
> few years...
> I'm not against classes as a near-term objective, but in order to *be*near-term and not to unwind in committee, I believe they have to be dead
> simple and prototypal, with very few knobs, bells and whistles.

I am indeed proposing this as a near term objective. The usual caveats
apply: we are asking the committee to approve the general shape presented by
this strawman, with syntactic and semantic refinements expected to continue,
for this as for all other proposals, after May.

Brendan, with all the simplifications since you posted this email, in your
opinion, have we achieved the level of simplicity needed?

> Factoring out privacy


> and leaving constructor in charge of per-instance property setting, as it
> is in ES5,


> would IMHO help.

Hope so ;).

I do understand that this page may be hard to appreciate without motivation
and examples. I'm hoping these are coming soon.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110517/5aa3bcf3/attachment-0001.html>

More information about the es-discuss mailing list