FunctionDeclaration as an element of a Block statement's StatementList

Garrett Smith dhtmlkitchen at gmail.com
Tue May 20 12:58:30 PDT 2014


"Prior to the Sixth Edition, the ECMAScript specification did not
define the occurrence of a FunctionDeclaration as an element of a
Block statement's StatementList."

The problem is not necessarily that FunctionDeclaration appears in a
Block, that FunctionDeclatation appears  in places in a program where
a Statement is permitted but a FunctionDeclaration is not.

ES5 mentioned it:

"Several widely used implementations of ECMAScript are known to
support the use of FunctionDeclaration as a Statement."

I don't have a concrete proposal, but I wonder why specifying as ES6
does makes less sense to take the text that ES5 had in s 12 and
attempt to codify, as ES6 does, except using Statement instead of
StatementList.

http://ecma-international.org/ecma-262/5.1/#sec-12
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-web-legacy-compatibility-for-block-level-function-declarations

-- 
Garrett
@xkit
ChordCycles.com
garretts.github.io


More information about the es-discuss mailing list