Function declarations in statements

Igor Bukanov igor at
Mon Mar 19 04:07:51 PDT 2007

On 18/03/07, Brendan Eich <brendan at> wrote:
> It's still different, according to ECMA-262 10.1.3, second bulleted item vs.
> third -- note how var does not create a new property if one already exists:

OK, lets then be 100% compatible with ECMA-262 while still making
uniform rule for functions declared in any statement. That is, the
suggestion for any such function declaration is to always define a new
variable property whose initial value is undefined at the beginning of
script or function execution and initialize it with function object at
the beginning of the execution of the statement that contains the
function declaration.

For the examples see the previous post from David that nicely
summarizes the proposal.

> Backward compatibility is required here, since script on the web declares
> functions with names that replace pre-defined properties that may not have
> the right default attributes (in particular, may be ReadOnly and
> DontDelete).

Then SpiderMonkey violates the standard here as declaring in a web page

  function document() { }

leads to "Error: redeclaration of const document" while MSIE does
replace otherwise ReadOnly/DontDelete document by the function

Regards, Igor

More information about the Es4-discuss mailing list