Conrad said:
So what about them? That's not a reason to prefer variables over window
properties.
Let's see: `window' refers to a host object that has quite a few built-in
host properties. Per Specification, host objects do not need to implement
ECMAScript's [[Get]] and [[Put]] algorithms as they are. And you say that
this is not reason enough not to use that host object as a container for a
poor substitute of well-specified global variables?
Any script on that page can change it.
I know what I am writing.
or set it to null (ignoring 'const', for the moment). [...]
I know this. You missed the point of that posting completely.
Then enlighten me: [...]
Not possible. You are too fixated on the `DontDelete' part to notice
anything else.
Nobody said anything about a proof (except you),
So you'd rather jump to conclusions?
and a theory isn't made worthless by the technical inability to prove it.
[...]
The theory argument again. How boring. Don't you think that things known
for sure, because they are specified and implemented so, have a little bit
more value in practice than things that can only be theorized about?
It cannot be known for sure that the host-defined `window' property is
always available, if available refers to the Global Object, and thus these
two are interchangeable; that is only a theory (of yours), if that. By
contrast, it is known for sure that there is a Global Object that can be
referred to by `this' in global context, and in an immediately called
function expression.
It cannot be known for sure whether properties of the Global Object are
always reflected in the properties of the object that `window' refers to.
By contrast, it is known for sure that global variables are properties of
the Global Object as this object is the Variable Object of the global
execution context.
and it's even mentioned in the ECMAScript specs (10.1.5): [...]
As an example. How many times do you need to be told that examples in
specifications are never normative?
I never said it was normative, [...]
You implied it. Why else would you have quoted it in that context? Only to
support your fallacious argumentation that is only based on proof-by-example
("Here, mommy, I found another one! Even the Spec says I'm right!"), or
bare assertion.
PointedEars