Update on ES3.1 block scoped function declarations

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Thu Jul 10 10:55:05 PDT 2008

We discussed these issues at today's ES3.1 conference call and arrived at a new plan of record:

1) We concluded that the present diversity of semantics of block nested function declarations among browser implementations probably cannot be replaced with a standard semantics without significant breakage of the web. One compelling use case is the apparent common usage of the difference in IE and FF semantics  in this regard as a browser identification test. So, for ES3.1 we will not change the ES3 stance on such function declarations. This means, that block nested functions will not be part of the ES3.1 syntax or semantics.  The occurrence and meaning of them in an implementation dependent non-standard language extension that is  allowable by section 16.  Our expectation is that most implementations will just continuing doing what they currently do.

2) While we can't reconcile the divergent existing semantics of function declarations within blocks, we can discourage  their on-going use.  To that end, the cautious subset will specify that the occurrence of such a function declaration must be reported as a syntax error at scan time. So, while section 16 of the full ES3.1 language implicitly permits implementations to allow  block nested function declarations, the opt-in cautious subset explicitly withdraws that permission.

3) We will still include lexically scoped block environments, but only for const declarations. If you want to define a block scoped function, do it using a const whose value is a function expression.  In a latter revision, we would expect to also add block-scoped let declaration to enable block scoped variables.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.mozilla.org/pipermail/es-discuss/attachments/20080710/e0b4d1b1/attachment-0002.html 

More information about the Es4-discuss mailing list