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

Mike Samuel mikesamuel at gmail.com
Fri Jul 1 15:22:27 PDT 2011


2011/7/1 Brendan Eich <brendan at mozilla.com>:
> 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.

Fair enough.


More information about the es-discuss mailing list