Is class syntax really necessary ?

Alex Russell alex at
Mon May 23 10:05:43 PDT 2011

On May 23, 2011, at 9:45 AM, Angus Croll wrote:

> Sugar is fine for defining classes (as opposed to defining types in terms of
> the constructor) but I get a little worried when I see the 'extends'
> keyword. I'm probably biased but I see many JavaScript trainees eager to
> simulate classical inheritance because it fits right in their comfort zone.
> It's been said a million times before but one of the
> most appealing characteristics of the JavaScript language is the
> availability of so many alternatives to rigid inheritance patterns (e.g.
> mixins, delegation, composition) which can liberate the developer from the
> confines of the traditional 'class' hierarchy and promote more flexible and
> readable code.

Sorry, but I'm not buying it. That same flexibility leads to the tower of babel, and in any case, nobody is looking to remove any of that power with the proposals on offer. They're simply trying to pave the proverbial cow-paths. Don't hold up the train for a perceived slight...but do yell if you think something is actually being taken away.

> If Dmitry is right in saying once class + extends is available "everyone
> will just start to use it" I'm concerned that this may be to the detriment
> of the language.
> thanks
> Angus
> On Mon, May 23, 2011 at 9:14 AM, Isaac Schlueter <i at> wrote:
>> On Mon, May 23, 2011 at 08:51, Brendan Eich <brendan at> wrote:
>>> Class syntax is like a lint brush for such features. If we add it, it
>> will accrete more semantics (with unambiguous syntax, I hope) over time.
>> This is just inevitable, in my view. It makes me want to resist classes and
>> look at smaller and more direct fixes for the two known prototypal hazards.
>> Yes, please!
>> I assume "two known hazards" is referring to your previous email:
>> "subclassed prototype/constructor set-up and super calls."
>> I've been using this pattern in my OOP javascript programs lately:
>> It works really well, behaves as expected (easy for the author to say,
>> ha, but it doesn't violate instanceof, doesn't call ctors more than
>> once, doesn't clobber already-added prototype properties, etc.)  And
>> it's about 10 lines, easy to read and grok.
>> What would make it even nicer, however, with minimal added syntax:
>> 1. Call "super(a, b, c)" instead of ", a, b, c)"
>> 2. Maybe Parent.extend(Child) or Child.inherit(Parent) instead of
>> inherits(Child, Parent)
>> 3. Right now, calling parent versions of overridden methods is a
>> painful: "".
>> It'd be nice to use something like "super.someMethod()".
>> _______________________________________________
>> es-discuss mailing list
>> es-discuss at
> _______________________________________________
> es-discuss mailing list
> es-discuss at

Alex Russell
slightlyoff at
slightlyoff at
alex at BE03 E88D EABB 2116 CC49 8259 CF78 E242 59C3 9723

More information about the es-discuss mailing list