Why are global variables *non-deletable* properties of the global object?

Mark S. Miller erights at google.com
Thu Jun 19 16:39:55 PDT 2008

In ES3:

10.2.1	Global Code
The scope chain is created and initialised to contain the global
object and no others.
Variable instantiation is performed using the global object as the
variable object and using property attributes { DontDelete }.
The this value is the global object.

I was puzzled by the DontDelete in the above spec language. Firefox
and Safari seems to disagree:

'foo' in window

var foo = 3;

'foo' in window

delete window.foo

'foo' in window

I prefer FF and Safari's behavior to the ES3 specified behavior. Which
should ES3.1 and ES4 codify as correct? Should we drop the
"DontDelete" in the spec language? (Concretely, the current ES3.1
draft reflects the meaning of the ES3 spec by saying that the
[[Dynamic]] attribute is false. I'm asking whether we should change
this to true.)


More information about the Es4-discuss mailing list