minimal classes

David Herman dherman at
Mon Jun 27 22:00:12 PDT 2011

I've been concerned about the schedule risk of classes for; following are some thoughts about a minimal class feature that I believe satisfies the most important needs while leaving room for future growth.

I think the bare-minimum requirements of classes would be:

- declarative class expressions
- declarative constructor/prototype inheritance (i.e., the extends clause)
- super-calls
- declarative methods


    class C {
        constructor(x, y) {
            this.x = x;
            this.y = y;
        foo() {
            return this.x + this.y;

    class D extends C {
        constructor() {
            super(0, 0);
        bar() {

I suggest that for, we completely leave out declarative properties, class properties, or even private data. All of this can be expressed already with imperative features. (Private data can be implemented with private names, and I've come to believe that Object.freeze just simply shouldn't freeze private properties.) That's not to say that these features would never be desirable, but we've so far struggled to come up with something that hangs together. And the features I describe above don't close off these possibilities. I want classes to succeed for, and even more importantly I want to succeed and succeed *on time*.

I'd argue that the minimal feature set described above covers the most important needs:

- standardizing prototype hierarchies (I'm of the opinion that superclass constructors ought to be the prototype of subclass constructors in order to inherit class properties)
- providing declarative syntax for initializing the C.prototype object
- providing idiomatic syntax for calling the superclass constructor
- enabling instance-private and/or class-private data (via private names)


More information about the es-discuss mailing list