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

Brendan Eich brendan at mozilla.com
Sun Jul 17 17:58:57 PDT 2011

On Jul 17, 2011, at 3:14 PM, David Bruant wrote:

> Le 15/07/2011 23:04, Tom Van Cutsem a écrit :
>> 2011/7/15 Brendan Eich <brendan at mozilla.com>
>> On Jul 15, 2011, at 12:38 PM, Allen Wirfs-Brock wrote:
>>> BTW, if http://wiki.ecmascript.org/doku.php?id=strawman:fixed_properties was extended to support Object.preventExtensions we might not have anything to argue about except perhaps performance issues. 
>> Indeed, that helps quite a bit. Glad to hear it.
>> But there may be more power needed in the fix trap, per the above Array-proxy test.
>> Glad to hear that too. I'll try to extend the FixedHandler with support for non-extensibility. David may beat me to it, though ;-)
> :-p
> I'm only catching up now on this thread. I have indeed started some work to try to implement an invariant-enforcing implementation of preventExtension rather than fix+become.

Just off the top of my head, sorry if I'm misunderstanding: fix based on become is very attractive to VM implementors, because it avoids extra for-life-of-fixed-object costs in the proxy or native code paths that aren't already there with Proxies as proposed and with ES5.

"becomes" lets the brain-swapped objects do what they do best. There's no hybridization as if by composition using vtbls, if statements, or whatever, that affects proxy codepaths. It's true one could "become" a proxy with the extra code paths, but that's duplicative at some level (not necessarily code inlining, but layering the extra preventExtensions enforcement somehow).

If the preventExtensions enforcement is the same as the pre-fix overhead for fixed properties, perhaps this is less of an issue.

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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110717/25e01c30/attachment.html>

More information about the es-discuss mailing list