Question of destructuring

Eric Suen eric.suen.tech at gmail.com
Sun Nov 9 00:24:39 PST 2008


Will destructuring and closures be included in ES3.1?

Where can I find the grammar of destructuring and closures in
mozilla JavaScript 1.8, because in mozilla docs site only list
some examples, that is not enough for write a parser.

Regards,

Eric Suen

----- Original Message ----- 
From: "Brendan Eich" <brendan at mozilla.com>
To: "Eric Suen" <eric.suen.tech at gmail.com>
Cc: "es-discuss" <es-discuss at mozilla.org>; "Jeff Dyer" <jodyer at adobe.com>
Sent: Sunday, November 09, 2008 11:15 AM
Subject: Re: Question of destructuring


> On Nov 8, 2008, at 9:40 AM, Eric Suen wrote:
>
>> https://developer.mozilla.org/en/New_in_JavaScript_1.7
>>
>> has following statement:
>>
>> for each (let {name: n, family: { father: f } } in people) {
>>  print ("Name: " + n + ", Father: " + f + "<br>\n");
>> }
>>
>> But in http://www.ecmascript.org/es4/spec/grammar.pdf
>>
>> ForInBinding ::= Pattern
>>  | VariableDefinitionKind VariableBinding
>>
>> VariableBinding ::= TypedIdentifier
>>  | TypedPattern VariableInitialisation
>>
>> VariableInitialisation ::= '=' AssignmentExpression
>>
>> Obviously "let {name: n, family: { father: f } }" is not a Pattern,
>> So, how the above statement is valid?
>
> It's a bug, thanks for pointing it out. The ES4 grammar is not being 
> maintained now AFAIK. Cc'ing Jeff.
>
> /be
> 




More information about the Es-discuss mailing list