Brendan Eich wrote: > On Feb 17, 2009, at 2:48 PM, Mark Miller wrote: >> On Tue, Feb 17, 2009 at 2:02 PM, Ian Hickson <i...@hixie.ch> wrote: >> Now, if the other page's script calls f() and g(), it will get different >> results (2 and 1 respectively, if I didn't screw up the example code). >> >> For HTML5, this behaviour has been defined in more detail. The global >> object is a Window object. This object is per-Document. The object >> returned by the "window" attribute on that global object is actually a >> WindowProxy object, which forwards everything to the "current" Window >> object. >> >> What do you mean by "current"? Are you proposing to legitimize the >> dynamic scoping behavior demonstrated by your example? > > What Ian showed is not dynamic scoping. > > var global = this; > function g() { return global.x; } > > The issue is what global.x means after the current page (the one > containing the script including these two lines) has been unloaded and a > new page loaded (while some other window keeps a reference to g).
Whatever is specified should not prevent an implementation from throwing an exception (ReferenceError would be most appropriate) in this case. I disagree, strongly, with the position attributed by Ian Hickson to "Mozilla, Apple, and Opera" that this option should be excluded on performance grounds; I think that position has no sound technical justification. -- David-Sarah Hopwood ⚥ _______________________________________________ Es-discuss mailing list Es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss