Is class syntax really necessary ?
brendan at mozilla.com
Mon May 23 08:51:58 PDT 2011
On May 23, 2011, at 8:31 AM, Brendan Eich wrote:
> On May 23, 2011, at 6:11 AM, Irakli Gozalishvili wrote:
>> 1. More syntax means larger language surface, which adds complexity more things to remember / learn. More things to consider in ES.next.next
> It's true, although not everyone learns it all up front. Especially where new syntax is not yet supported in all browsers, and the student is not using a compiler to translate new to old version.
> I think the sharper version of your (1) is: "class syntax is too much syntax to solve the problems people have with prototypal inheritance: subclassed prototype/constructor set-up and super calls."
> I agree with that.
To be fair, others want to hang more hats on class syntax, including traits (separate proposal) and const/abstract modifiers. Then there are the guards and trademarking strawmen.
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.
More information about the es-discuss