On Wed, Feb 20, 2013 at 11:52 AM, Nathan Wall <[email protected]> wrote:

> `Object.isFrozen` and `Object.isSealed` don't really seem that helpful to
> me for the very reasons you've discussed: They don't represent any real
> object state, so they don't accurately tell me what can be done with an
> object.  If I could I would argue in favor of their removal, though I know
> it's too late for that.
>
> I would be curious to see legitimate uses of `isFrozen` and `isSealed` in
> existing code if anyone has anything to offer.
>

I just took a look at uses of Object.isFrozen in Caja and I find that all
but one are either in tests (test that something is frozen) or in sanity
checks (if this isn't frozen, do not proceed further, or freeze it and
warn).

The remaining one is in a WeakMap abstraction used for trademarking: an
object cannot be given a trademark after it is frozen. (The rationale here,
while not written down, I assume is that a defensive object's “interface”
should not change, and it is an implementation detail that this particular
information is not stored in the object.) There is a comment there
suggesting we might strengthen this check to only permitting _extensible_
objects to be marked.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to