Cannot make sense of some JavaScript

D

David Mark

David said:
Thomas 'PointedEars' Lahn said:
David Mark wrote:
:
David Mark wrote:
Thomas 'PointedEars' Lahn wrote:
David Mark wrote:
Thomas 'PointedEars' Lahn wrote:
David Mark wrote:
Thomas 'PointedEars' Lahn wrote:
David Mark wrote:
(2) Checking *this* against *GLOBAL* (which in our case would be
*window*, right?) misses all cases where Hash might have been assigned
In a browser, it would be the same as window.
It *may* *mean* the same as `window'.  [...]
In a browser, yes.
You don't know that for sure because you just can't know it for sure.
Happily, there is no need to assume it.
If so, you have not provided hard proof as of yet.
Hard proof of what?  That you don't have to assume the window is the
global object?
Prove that `window' works like the ECMAScript Global Object in all
browsers that are known to exist.
References the global object?  "Works like" has other implications.
Referencing boils down to "works like" in these languages.
As you know, such a proof is virtually impossible.  That's why it's
best not to assume the premise.
No, it rather shows without the shadow of a doubt that your argument
is flawed.
And what argument would that be?  I contend it is not a good idea to
assume the window object is the global object.
Not mine.

Then I would have to remind you that you did reply:

| > (2) Checking *this* against *GLOBAL* (which in our case would be
| > *window*, right?) [...]
|
| In a browser, it would be the same as window.

"Would" was too strong perhaps. Of course, every browser encountered
to date adheres, but theoretically there could be at least one that
does not. Regardless, there is no reason to assume anything about it.
The code being referred to was (your own):

  var GLOBAL = this;

Nothing wrong with this. No reference to window at all.

[snip]
 
T

Thomas 'PointedEars' Lahn

David said:
Thomas 'PointedEars' Lahn said:
David said:
Fallacy of the undistributed middle: X is a browser (or: X and Y and Z
are browsers). `window' seems to refer to/works like the ECMAScript
Global Object (regarding global variables) in X (or: in X and Y and
Z); therefore, window' refers to the ECMAScript Global Object in all
browsers.
Not mine.
Then I would have to remind you that you did reply:

| > (2) Checking *this* against *GLOBAL* (which in our case would be
| > *window*, right?) [...]
|
| In a browser, it would be the same as window.

"Would" was too strong perhaps. Of course, every browser encountered
to date adheres, but theoretically there could be at least one that
does not. Regardless, there is no reason to assume anything about it.

Logic dictates that there is every reason to assume everything about
that which is unknown.
Nothing wrong with this. No reference to window at all.

You miss the point which is that using `window' in place of `GLOBAL' (as
Hubert suggested) would _not_ be equivalent. You said it would, "in a
browser". And the error lies *there*.


PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,123
Messages
2,570,740
Members
47,295
Latest member
riya007

Latest Threads

Top