Is the mutability of bindings in strict eval code observable in the language?

Jeff Walden jwalden+es at MIT.EDU
Mon Oct 18 11:23:21 PDT 2010


On 10/18/2010 11:10 AM, Brendan Eich wrote:
>> Per the delightfully mind-twisting behaviors referred to in the "Assigning to globals in strict mode" thread, |delete foo| throws in strict mode.  That's the only way I can think of (if such a delete worked) that such bindings being mutable could be observed.
>
> You mean configurable, in ES5 terms, by mutable, right?

No, mutable.  (Recall we're talking about environments, which use mutability rather than configurability as the name for the frob, and not objects with properties.  Or rather, they do except for the"configurableBindings" name used in 10.5 to remember whether the code being entered is eval code.  Sigh.)


>>   And since eval code gets its own Lexical Environment, the bindings aren't observable in any code that isn't strict mode.  Is there another way?  Flipping such bindings to be non-configurable would be a nice simplicity win in SpiderMonkey, if it's doable without violating the spec.
>
> Sounds doable, this was also intentional, IIRC. We really want those strict-eval var bindings not to appear to be properties on any object (so delete does not compute).

It's certainly doable.  The question is whether it is incompatible with the spec (ignoring those things like our scope chain being exposed to JSAPI; but we can remove, refactor, deprecate, or obsolete that to eliminate that problem).  I don't see a way that it is, but maybe someone's more observant than me and will see one if I ask.

Jeff


More information about the es5-discuss mailing list