Call for opinions: attribute defaults and renaming "flexible"

Ingvar von Schoultz ingvar-v-s at comhem.se
Fri Sep 5 14:33:45 PDT 2008


Mark S. Miller skrev:
> On Wed, Sep 3, 2008 at 10:58 PM, Brendan Eich <brendan at mozilla.org> wrote:
>>> If deletable and
>>> configurable were distinct, we could make new properties of the global
>>> object start as configurable but not deletable.
>> Saving perf but to what end? Does the Caja, etc. programming model
>> require configurability before freezing for all global props, or a
>> few, or one?
>>
>>> However, adding
>>> another attribute to deal with this one problematic case seemed
>>> overkill. Allowing non-configurable properties to be made non-writable
>>> seems like the simplest adequate solution.
>> Not arguing, just recapitulating and asking for the Caja use-case.
> 
> The use case is that the Caja runtime gets loaded into a frame after
> writable-but-non-deletable properties that we wish to whitelist have
> been added to the global object. The Caja runtime needs to freeze all
> whitelisted objects and properties reachable from from the global
> object.
> 
> In ES3.1 as we're proposing it, the only way to represent that a
> property is non-deletable is to make it non-configurable. If writable
> non-configurable properties could not be made non-writable, the use
> case above would be screwed.

It would be much better if Object.freeze() got an added
parameter, a bit flag that, when set, makes it more powerful
and allows it to override the configurability flag. Then
the override happens only when you enable it explicitly.

Otherwise we have a case of silent failure, and silent failures
are often very expensive to debug.

-- 
Ingvar von Schoultz



More information about the Es-discuss mailing list