On Oct 29, 2014, at 4:03 PM, Boris Zbarsky <[email protected]> wrote:

> On 10/29/14, 2:55 PM, Allen Wirfs-Brock wrote:
>> ES since forever have made special provisions about when shadowing of such 
>> properties are allowed.  Both global var and function declarations reused 
>> any global object existing property for the declared name, except that 
>> function declarations refused to change the value of non-configurable 
>> readonly properties.
> 
> "var undefined = 5" doesn't change the value of undefined evaluated in global 
> scope, right?

Prior to the ES5 spec. it actually did, as undefined was writable.

> 
>> If browsers use the same semantic mechanisms a libraries (or the 
>> implementation level equivalent) then they will behave identically.
> 
> What browsers are doing here is defining non-configurable accessor (or 
> readonly value, for some browsers) properties on the global.  As far as I can 
> tell, "var" and "function" can't mess with such properties today.

It’s a bit more complicated than that. See 
https://bugs.ecmascript.org/show_bug.cgi?id=78 which is a bug against ES5.1 is 
addressed in the ES6 spec. Also see the reference firefox bug.  I suspect it 
will jog you memory.

Allen


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

Reply via email to