> Does not say class, seems to save only a few chars (you 
> over-parenthesize new ;-). Wait for demand?

It's not about saving chars so much as introducing a new (lightweight) 
semantic concept: an object initializer that is a block rather than a 
table mapping names to expressions. Not saying `class' is the point.

I over-parenthesized because I wasn't sure how it would parse if you 
said e.g.

     new class() { ... }.foo

>> or maybe to conserve keywords (a bit backwards-incompatible):
>>
>>      new { ... } ~=~ (new (class() { ... }))
> 
> This is not incompatible at all, since an object initialiser has no 
> [[Construct]] in ES3, so cannot be the operand of new.

Right, but that means that existing code isn't using this form, so you 
could steal this special case; then the argument to `new' would have to 
be an expression that didn't start with '{', just like expression 
statements. It's backwards-incompatible but since the current syntax 
only leads to a useless error, I doubt real code is using it.

Dave
_______________________________________________
Es-discuss mailing list
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to