By the time [[HasProperty]] (and `"foo" in p`) finishes, the property doesn't exist anymore, therefore this invariant is not enforced. The invariant is: if the property *exists* and the object is non-extensible, [[HasProperty]] must return true. So, there's no guarantee it returns true if you've deleted the property.
On Sun, Mar 5, 2017 at 4:45 PM, Oriol _ <[email protected]> wrote: > Yes, but the point is that if the property is removed, then > [[HasProperty]] will return false, and thus the invariant can't be > enforced, because an exotic object might behave like if the property was > deleted under the hood. > > Since you say the invariant is enforced for exotic proxy objects, you may > prefer a counterexample for these: > > ```js > var target = Object.preventExtensions({foo: "bar"}); > var p = new Proxy(target, { > has: (target, prop) => !Reflect.deleteProperty(target, prop) > }); > > // Object is non-extensible > Object.isExtensible(p); // false > > // foo is an observable own property > !!Object.getOwnPropertyDescriptor(p, "foo"); // true > > // [[HasProperty]] returns false > "foo" in p; // false > ``` > > -Oriol >
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

