Sep 27 meeting notes

Brendan Eich brendan at mozilla.com
Fri Sep 30 01:45:35 PDT 2011


On Sep 30, 2011, at 2:38 AM, Allen Wirfs-Brock wrote:

> On Sep 29, 2011, at 4:54 PM, Brendan Eich wrote:
> 
>>>  }  // optional comma from @awbjs
>>>  get x() { return this._x; }
>>>  prop: 42,
>>>  method() {}  // method form @awbjs
>>> };
>> 
>> Waldemar had some objections to comma elision in object literals, they would apply here too or need to be overcome.
> 
> I don't see why: 
>   let obj = {
>         x: 1,  //comma required
>         foo () {}  //comma optional 
>         y=2}   // comma optional (and the same line } is intentional

(not sure what y=2 is doing there -- did you mean : not = ?)

The problem comes from computed-property-name syntax:

let obj = {foo() {}
                [bar]: baz};

You may think that's ok, but here it is all on one line:

let obj = {foo() {} [bar]: baz};

If for some reason you need to go back to old-style foo:function(){}, you lose.


> How about:
>  class Derived extends Base {
>    constructor () x {

Looks like a typo, fails to show that the constructor takes an x parameter.

Not sure you intended this, though -- the mustache with class methods may be the main thing:


>    }
>    ...
>    method () {
>   }
> }. {
>    /* class methods */
> }
> 
> which desugars  in the obvious way.
> 
> Class methods are few in number and this emphasis that you are really defining properties on the class object

That's not true in JS -- we have class methods and constants in the built-ins. In CoffeeScript we have class methods and (Swiss-style) class-side inheritance.

We can certainly defer class-side stuff but there are long-hands to sugar, right now, and the desugaring seems straightforward to me. To avoid the nasty static keyword, we could use Bob's class: labeled section approach.

Labeled sections are hostile to data property initialiser syntax but I claim we don't want that anyway. What say you?

/be



More information about the es-discuss mailing list