Sep 27 meeting notes

Brendan Eich brendan at
Thu Sep 29 07:52:06 PDT 2011

On Sep 29, 2011, at 3:20 PM, Russell Leggett wrote:

> On Wed, Sep 28, 2011 at 10:40 PM, Oliver Hunt <oliver at> wrote:
> Given our apparent desire to have a declarative syntax i don't see why something akin to:
> class Foo {
>    var bar; // default value -> undefined
>    var wibble = 5; // initialised fields desugar to statements at the head of the constructor
>    const wiffle; // read barrier on uninitialised
>    function someMethod(..) {
> = foo; // could have a short hand for
>    }
>    constructor (bar, wibble) {
>        // extra typing due to the removal of horrible punning
>        // but "public bar = bar" or whatever that syntax was is longer
>        // than
> = bar;
>        this.wibble = wibble;
>    }
> }
> function's get shoved on to the prototype chain, and fields go on the instance, inheritance follows reasonably sensibly from that.  Remove the declarative field definitions and you have essentially got python's class model, which seems to be well accepted by a wide array of people, otherwise the question becomes one of how much you want to lock down the resultant object shape.
> --Oliver
> Hi, just a voice from the peanut gallery - of the proposals going on right now, I really like this proposal a lot. Perhaps it is just my experience with Java, but this feels like an intuitive class syntax that also stays feeling like JavaScript. I like that it doesn't introduce a new keyword "public" which I especially didn't like because there was no "private" keyword.

This syntax is awfully familiar from original-JS2/ES4 (Waldemar's 1999-2003 effort) and the 2006-2008-era ES4.

There are some on the committee who object to 'var' in particular; others object to using scoped binding forms to define properties in (default mutable) objects. We can go around this block again, though.

> In regards to private fields/methods in classes, I did also have a thought that perhaps you could use proxies to provide a peephole view of a class instance.

Proxies are too heavyweight. We have private name objects:

which can be implemented very cheaply, and our current consensus for private in classes is that you would bind module- or block-scoped consts to private names, one per class-private instance variable, and then use them via this[priv] = initialValue, Object.create, Object.defineProperty, etc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list