Assigning to globals in strict mode
jason.orendorff at gmail.com
Tue Oct 19 13:18:40 PDT 2010
On Tue, Oct 19, 2010 at 2:05 PM, Oliver Hunt <oliver at apple.com> wrote:
> On Oct 19, 2010, at 11:59 AM, Mark S. Miller wrote:
>> On Tue, Oct 19, 2010 at 11:49 AM, Oliver Hunt <oliver at apple.com> wrote:
>>> Minefield nightlies currently throw after evaluating rhs, webkit throws
>>> after the lhs is evaluated.
>>> Given I think both interpretations are valid the spec really should be
>>> updated to state the exact moment that an exception is thrown.
>> I agree. Which interpretation do you recommend?
> I honestly think that throwing after LHS is evaluated and found to be an
> undefined reference makes the most sense -- it prevents the example i
> brought up earlier from really being a problem (as you never get to the
> point where the global is created) and prevents you from causing any side
> effects prior to the exception being thrown.
Hang on -- that doesn't prevent this weirdness:
"use strict"; this.x = 1; x = delete this.x;
That's the weirdest example of them all. If there's an elegant way to
get rid of that, let's try. Otherwise let's leave it.
More information about the es5-discuss