[[Extensible]]and Proxies (Was: Proxy.isProxy )

Brendan Eich brendan at mozilla.com
Mon Jul 18 10:52:05 PDT 2011


On Jul 18, 2011, at 2:06 AM, David Bruant wrote:

> By enforcing ES5 invariants, we actually are trying to enforce things that are enforced for normal objects already. If you haven't read Tom's FixedHandler implementation [1], I encourage you to, because the minimalism of it is quite interesting.

Read it, very slick. Has it changed recently?


> Especially, in the get{Own}PropertyDescriptor and defineProperty traps, Object.defineProperty is called and as commented, the purpose is to (re)use the argument-checking code of this method to let it throw if needed. It's extremely generic and future-proof with regard to new sorts of property descriptors.

That is a good sign, and anything else would be a "bad sign" ;-).


> We'll see what the implementation of invariant checking non-extensible proxies looks like.

This is the crucial part.


>> Sticking with becomes, but (a) distinguishing preventExtensions from seal from freeze and (b) allowing the [[Class]] or ES.next equivalent to be controlled would allow, e.g., Proxy-emulated Arrays that fix to become real (pE'ed, sealed, or frozen) Arrays.
> Distinguishing preventExtensions from seal from freeze will still be possible with an invariant-enforcing proxy if that's the chosen solution.

Is there a proposal?

/be


More information about the es-discuss mailing list