On Dec 15, 2012, at 9:21 AM, David Bruant wrote:

> Hi,
> 
> On public-script-coord, Boris Zbarsky showed an example [1] where a global 
> variable is var-defined and then observed to be absent from the global object 
> it was attached to (because the WindowProxy has changed of underlying window 
> object).
> 
> The careful ECMAScript 5.1 reader knows that global var-defined variables are 
> supposed to be reflected as own non-configurable properties of the global 
> object. Reflecting the property as such commits the object to keep the 
> property forever which, as we've seen in Boris example, is not compatible 
> with how the web works.
> 
> I don't think it'll be possible to change how global objects in same-origin 
> iframes work nor relax ES5 invariants; so my proposal is to have 
> var/let/const/function global declarations *reflected* as configurable, but 
> acting as if they were not.
> This would also require a couple of changes in the spec and consequently JS 
> engines and certainly test262.
> Other proposals welcome, of course.

Note that in ES6 global bindings introduced by  let/const/class/import bound 
using a declarative environment record  and will not be reflected at all on the 
global object.

That still leaves any issues relating to var and function declarations.

Allen



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to