Attribute defaults for Object.defineProperty

David-Sarah Hopwood david.hopwood at industrial-designers.co.uk
Fri Aug 22 11:53:15 PDT 2008


Allen Wirfs-Brock wrote:
> Michael Haufe [mailto:TNO at TheNewObjective.com] said:
>>> Although I'd prefer to control Deletable separately from Fixed,
> 
> Using a single state to control deletability, attribute mutability, and
> property transformation/replacement is a compromise.  There may be some
> situations where somebody would really like to control these separately
> but it is probably a pretty limited use case.

If you can set attribute mutability, then you can set the Delete attribute.

If you can set the Delete attribute, then you can delete the property
(and its current attributes).

If you can delete the property, then you can recreate it with different
attributes.

So, there is neither a security nor an expressiveness argument for making
any distinction between these rights. An argument for separating them
would have to be based on convenience (but it seems less convenient, not
more), or on preventing inadvertent, non-malicious changes, or possibly
on efficiency (but these operations are probably not common enough for
that to be significant).

-- 
David-Sarah Hopwood


More information about the Es-discuss mailing list