ES6 opt-in, reloaded

Allen Wirfs-Brock allen at wirfs-brock.com
Mon Jan 16 17:47:03 PST 2012


One of the thing that an "ES6" (or "extended code" as it is currently known in the ES6 draft) mode  that is distinct from "strict mode" does is allow us do add additional Early Errors that aren't in ES5 for various existing constructs.  It isn't clear that we could continue to have add these errors if we don't have this "mode" distinction as they are generally potentially breaking changes. Just to see what the impact of that might be I've extracted all such error that are in current ES6 draft. Note that this list is not necessarily exhaustive as  there may well be additional such errors that would apply to parts of the spec. that I haven't worked on yet.

PropertyAssignment : get PropertyName () { FunctionBody } 

•	It is a Syntax Error if the source code matching this production is extended code and the PropName of PropertyName also occurs in the VarDeclaredNames of FunctionBody.
•	It is a Syntax Error if the source code matching this production is extended code and the PropName of PropertyName also occurs in the LexicallyDeclaredNames of FunctionBody.

PropertyAssignment : set PropertyName ( PropertySetParameterList ) { FunctionBody } 

•	It is a Syntax Error if the source code matching this production is extended code and the PropName of PropertyName also occurs in the VarDeclaredNames of FunctionBody.
•	It is a Syntax Error if the source code matching this production is extended code and the PropName of PropertyName also occurs in the LexicallyDeclaredNames of FunctionBody.
•	It is a Syntax Error if the source code matching this production is extended code and any element of the LexicallyDeclaredNames of PropertySetParameterList also occurs in the VarDeclaredNames of FunctionBody.
•	It is a Syntax Error if the source code matching this production is extended code and any element of the BoundNames of PropertySetParameterList also occurs in the LexicallyDeclaredNames of FunctionBody.

PostfixExpression :
LeftHandSideExpression [no LineTerminator here] ++
LeftHandSideExpression [no LineTerminator here] --

•	It is a Syntax Error if the AssignmentExpression is contained in extended code and the LeftHandSideExpression is a Literal or a FunctionExpression.
•	It is a Syntax Error if the AssignmentExpression is contained in extended code and the LeftHandSideExpression is an Identifier that does not statically resolve to a declarative environment record binding or if the resolved binding is an immutable binding.
UnaryExpression :
delete UnaryExpression
++ UnaryExpression
-- UnaryExpression

•	It is a Syntax Error if the UnaryExpression is contained in extended code and the derived UnaryExpression is a Literal or a FunctionExpression.
•	It is a Syntax Error if the UnaryExpression is contained in extended code and the derived UnaryExpression is an Identifier that does not statically resolve to a declarative environment record binding or if the resolved binding is an immutable binding.
AssignmentExpression :
LeftHandSideExpression  = AssignmentExpression 
LeftHandSideExpression AssignmentOperator AssignmentExpression

•	It is a Syntax Error if the AssignmentExpression is contained in extended code and the LeftHandSideExpression is a Literal or a FunctionExpression.
•	It is a Syntax Error if the AssignmentExpression is contained in extended code and the LeftHandSideExpression is an Identifier that does not statically resolve to a declarative environment record binding or if the resolved binding is an immutable binding.

Block : { StatementList }  

•	It is a Syntax Error if StatementList includes a StatementListItem : Declaration production whose Declaration is a Declaration : FunctionDeclaration production  and the source code matching this Block production is not contained in extended code.
Block : { StatementList }  

•	It is a Syntax Error if StatementList includes a StatementListItem : Declaration production whose Declaration is a Declaration : FunctionDeclaration production  and the source code matching this Block production is not contained in extended code.
Catch : catch ( CatchParameter ) Block  

•	It is a Syntax Error if the code that matches this production is contained in extended code and any element of the BoundNames of CatchParameter also occurs in the VarDeclaredNames of Block.
FunctionDeclaration : function BindingIdentifier ( FormalParameterList ) { FunctionBody }
and
FunctionExpression : function BindingIdentifieropt ( FormalParameterList ) { FunctionBody }

•	It is a Syntax Error if the source code matching this production is extended code and the BoundNames of BindingIdentifier also occurs in the VarDeclaredNames of FunctionBody.
•	It is a Syntax Error if the source code matching this production is extended code and the BoundNames of BindingIdentifier also occurs in the LexicallyDeclaredNames of FunctionBody.
•	It is a Syntax Error if the source code matching this production is extended code and any element of the LexicallyDeclaredNames of FormalParameterList also occurs in the VarDeclaredNames of FunctionBody.
•	It is a Syntax Error if the source code matching this production is extended code and any element of the BoundNames of FormalParameterList also occurs in the LexicallyDeclaredNames of FunctionBody.



On Jan 16, 2012, at 2:49 PM, David Herman wrote:

> On Jan 16, 2012, at 2:47 PM, Brendan Eich wrote:
> 
>> If we have already gone too far in terms of runtime "five fingers of fate" changes with completion reform, we can pare back. But I'd like to give c.r. a chance -- it may be non-breaking.
> 
> Yes, absolutely. I believe it's got non-breaking potential. I'm not sure but it might even be OK to make the change in all contexts.
> 
> Dave
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120116/2516cf3f/attachment-0001.html>


More information about the es-discuss mailing list