Assigning to globals in strict mode

Jason Orendorff jason.orendorff at
Mon Oct 18 10:08:03 PDT 2010

Oliver's original message seems exactly right to me. I'll spell out
what I *think* is happening.

On Sun, Oct 17, 2010 at 4:56 PM, Oliver Hunt <oliver at> wrote:
> "use strict"; undeclared = (this.undeclared = 5);
> Should throw as |undeclared| will not exist when LeftHandSideExpression is evaluated.


* The left hand side evaluates to an unresolveable strict Reference (§;
* the right hand side evaluates to 5;
* assignment to the Reference throws, because it is still
unresolveable (see IsUnresolvableReference, §8.7), even though
undeclared now exists.

> "use strict"; this.declared = 5; declared = (delete declared, 5);
> Will not throw, but instead will recreate the |declared| property.

Right again.

* The left hand side evaluates to a property Reference;
* the right hand side evaluates, deleting the property
* assignment succeeds because the reference is not unresolveable, even
though the property was deleted.


More information about the es5-discuss mailing list