Unifying Block and ObjectLiteral (was: Re: block-lambda revival)

Brendan Eich brendan at mozilla.com
Fri Jul 1 14:54:17 PDT 2011


On Jul 1, 2011, at 10:51 AM, Mike Samuel wrote:

> What is
> 
>   ({
>     get
>     x()
>     {
>       return 42;
>     }
>   })
> 
> ?
> 
> Could it match both as an object literal with a getter
> 
>   ({ get x() { return 42; } })

Only that.


> or as a block with 3 statements?
> 
>   ({ get; x(); { return 42; } })

No, never. You're forgetting the first rule of ASI fight-club: if there's no error there is no semicolon insertion.

/be



More information about the es-discuss mailing list