Array.isArray(new Proxy([], {})) should be false (Bug 1096753)

Allen Wirfs-Brock allen at wirfs-brock.com
Sat Nov 15 08:47:04 PST 2014


On Nov 15, 2014, at 1:24 AM, David Bruant wrote:

> Le 13/11/2014 17:29, Boris Zbarsky a écrit :
>> On 11/13/14, 6:44 AM, Andreas Rossberg wrote:
>>> Well, the actual diabolic beast and universal foot gun in this example
>>> is setPrototypeOf. ;)
>> 
>> Note that there is at least some discussion within Mozilla about trying to make the prototype of Object.prototype immutable (such that Object.getPrototypeOf(Object.prototype) is guaranteed to always return the same thing, modulo someone overriding Object.getPrototypeOf), along with a few other things along those lines.  See <https://bugzilla.mozilla.org/show_bug.cgi?id=1052139>.
> This would result in objects which [[Prototype]] cannot be changed but which properties can be changed.
> This is not possible per ES6 semantics I believe unless the object is a proxy (which setPrototypeOf trap throws unconditionally and forwards the rest to the target). Is it a satisfactory explanation? Should new primitives be added?

Actually the ES6 semantics does allow for this.  The global object would have t be implemented as a new kind of implementation specific exotic object whose [[SetPrototypeOf]] internal method always returns false.

A Proxy would be required to self-host such an object using ES code, but at the implementation level a Proxy would not be required.

Allen


More information about the es-discuss mailing list