Assigning to globals in strict mode
jwalden+es at MIT.EDU
Mon Oct 18 10:05:39 PDT 2010
On 10/18/2010 09:59 AM, Oliver Hunt wrote:
> On Oct 18, 2010, at 9:56 AM, Jeff Walden wrote:
>> On 10/17/2010 02:56 PM, Oliver Hunt wrote:
>>> "use strict"; this.declared = 5; declared = (delete declared, 5);
>>> Will not throw, but instead will recreate the |declared| property.
>> Shouldn't |delete declared| throw per 11.4.1 5a?
> No because declared is deletable -- i didn't do 'var declared', it's an ordinary object property that just happens to be on the global object.
I still read it differently. Evaluating |declared| in the delete expression should, per 11.1.2 and 10.3.1, result in a Reference. Per 10.2.2.1 step 4, that Reference should have a base which is an environment record and a strict mode flag of true. IsUnresolvableReference() is false because the base isn't undefined/false, IsPropertyReference() is false because the base value isn't an object or a Boolean/String/Number, so therefore you hit the step I mentioned. What am I missing?
More information about the es5-discuss