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

Tom Van Cutsem tomvc.be at gmail.com
Wed Jul 13 09:25:51 PDT 2011


Aren't arrays [[Extensible]]:true by default?

As to why the restriction, this is to uphold the following invariants (from
ES5 section 8.6.2):

- If the value of the host object‘s [[Extensible]] internal property has
been observed by ECMAScript code to be false, then if a call to
[[GetOwnProperty]] describes a property as non-existent all subsequent calls
must also describe that property as non-existent.

- The [[DefineOwnProperty]] internal method of a host object must not permit
the addition of a new property to a host object if the [[Extensible]]
internal property of that host object has been observed by ECMAScript code
to be false.

- If the [[Extensible]] internal property of that host object has been
observed by ECMAScript code to be false then it must not subsequently become
true.

Cheers,
Tom

2011/7/13 Allen Wirfs-Brock <allen at wirfs-brock.com>

> Hate to start another cycle of this,  but if (trapping) proxies can't be
> set to [[Extensible]]: false, then they can't be used to fully emulate
> built-ins such as Array.  Why is there this restriction?
>
> Allen
>
>
> On Jul 13, 2011, at 1:23 AM, Tom Van Cutsem wrote:
>
> Perhaps Proxy.isProxy was used merely as an example, but wasn't the
> consensus that Proxy.isProxy is not needed? Dave pointed out that it breaks
> transparent virtualization. Also, there is Object.isExtensible which always
> returns |true| for (trapping) proxies. That means we already have "half" of
> Proxy.isProxy without exposing proxies: if !Object.isExtensible(obj), obj is
> guaranteed not to be a proxy.
>
> Cheers,
> Tom
>
> 2011/7/9 Brendan Eich <brendan at mozilla.com>
>
>> Also the Proxy.isTrapping, which in recent threads has been proposed to be
>> renamed to Proxy.isProxy or Object.isProxy.
>>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110713/64dea66d/attachment.html>


More information about the es-discuss mailing list