Tab Atkins Jr. jackalmage at gmail.com
Fri Jun 28 11:40:00 PDT 2013


On Fri, Jun 28, 2013 at 11:31 AM, Eric Elliott <eric at ericleads.com> wrote:
> I'm not here to discuss the mechanics of what class does. I'm just saying we
> shouldn't do it in the spec. There are better alternatives that pose less
> threat to the JavaScript ecosystem.
>
> A handful of libraries and JavaScript authors twisting prototypes to make
> them less useful is one thing. Getting a blessing from on-high for people to
> teach that it's "how to do inheritance in JavaScript" in teaching materials
> is quite another thing.

It is how you do (single) inheritance in JS.  In your OP, you say "I
think we should wait for some patterns to gain a foothold in the
wild".  Single inheritance via prototype chains is an immensely
popular pattern for this kind of thing.  You do qualify your statement
by saying we should wait for *good* patterns, but single inheritance
is perfectly good for some things, and adequate for quite a bit else.
There are certainly better patterns, but none of them have gotten wide
traction yet.  We definitely want to pursue something like mixins in
the future, but in ES6 we purposely went for a "maximally minimal"
class syntax, adding as little as possible while still achieving the
readability and usability gains of having a dedicated syntax.

For example, when we come up with a good mixin pattern, adding it to
the class syntax is as easy as doing "class Foo mixin Bar, Baz, Qux
{...}".  No clash with "extends"; it just slots in cleanly.

> My arguments (and a few suggested alternatives) are in the video.
>
> If you're going to blow off what I have to say about it because you don't
> have time to watch a video, I guess the conversation is over. =)

In our private conversation, I just asked for a text version, as it's
several times faster to read text than listen to a talk.  It would
likely take you roughly as much time to write out the points you want
us to take from the video as I, individually, would save by being able
to read them instead of having to watch the video.  When multiplied
over the whole mailing list (or at least the people interested enough
in this thread to care), the balance of time is clearly on the side of
"just spend the time writing out what you want to say".

~TJ


More information about the es-discuss mailing list