Question on arrow function - if it is a bug or intentional in the spec ?

Suresh Jayabalan sureshja at microsoft.com
Tue Oct 1 16:35:20 PDT 2013


According to 14.2.1<http://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-early-errors>, the following arrow function expression should produce an early error :

x => {var x;}

Here is the spec line that mandates this rule. While this scenario is allowed in the regular functions (even in strict mode), I would like to understand the rationale behind this specific rule in arrow functions. Can someone shed some light on this ?

-------
14.2.1<http://people.mozilla.org/~jorendorff/es6-draft.html#sec-arrow-function-definitions-static-semantics-early-errors>Static Semantics: Early Errors
ArrowFunction : ArrowParameters => ConciseBody

*         It is a Syntax Error if any element of the BoundNames of ArrowParameters also occurs in theVarDeclaredNames of ConciseBody.

*         It is a Syntax Error if any element of the BoundNames of ArrowParameters also occurs in the LexicallyDeclaredNames of ConciseBody.
-------

Regards,
Suresh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20131001/2e5799a4/attachment.html>


More information about the es-discuss mailing list