get/setIntegrity trap (Was: A case for removing the seal/freeze/isSealed/isFrozen traps)

Nathan Wall nathan.wall at
Wed Feb 20 11:52:56 PST 2013

Allen Wirfs-Brock wrote:
> I think I previously asked if anybody is aware of situations where 
> Object.isFrozen tests are done but Object.freeze is not used to set 
> objects to the frozen state. So far, no answers. Anybody? 

Speaking just from my own experience as a user of ES5, I have not found `Object.isFrozen` to be helpful yet.  If I want to see if I can configure a property, I check `Object.isExtensible` and `!, key) || Object.getOwnPropertyDescriptor(obj, key).configurable`.

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


More information about the es-discuss mailing list