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
false
var foo = 3;
'foo' in window
true
delete window.foo
true
'foo' in window
false
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.)
--
Cheers,
--MarkM
More information about the Es4-discuss
mailing list