Assigning to globals in strict mode
oliver at apple.com
Sun Oct 17 14:56:15 PDT 2010
I'm just in the process of making jsc produce the correct error in strict mode when assigning to an undefined priority, and I just want to verify my understanding of the spec (which is somewhat confused by multiple people stating that in strict mode the assignment operator can never create a new global property).
Per section 11.13.1 an implementation should throw a syntax error if LeftHandSideExpression evaluates to an unresolvable reference, which means
"use strict"; undeclared = (this.undeclared = 5);
Should throw as |undeclared| will not exist when LeftHandSideExpression is evaluated.
"use strict"; this.declared = 5; declared = (delete declared, 5);
Will not throw, but instead will recreate the |declared| property.
I'm simply wanting to verify my interpretation of the spec prior to fixing this bug.
More information about the es5-discuss