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

Brendan Eich brendan at mozilla.org
Mon Oct 18 14:06:00 PDT 2010


On Oct 18, 2010, at 11:23 AM, Jeff Walden wrote:

> 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.

Ah so -- but this supports the case that these are not observable as if on an exposed object, as [[Configurable]] is.


>  Or rather, they do except for the"configurableBindings" name used in 10.5 to remember whether the code being entered is eval code.  Sigh.)

(Good point, I had just noticed that name the other day -- a nit but worth picking. Allen?)


>>>  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.

The strict-eval-created var bindings should not be subject to delete, or otherwise testable as if [[Configurable]] properties. If this were observable, it would be a flaw in the spec. I don't see it either.

Suggest you proceed accordingly unless someone on the list, especially Allen or Mark, can show a problem with doing so.

/be



More information about the es5-discuss mailing list