Object.freezing proxies should freeze or throw?
Raul-Sebastian Mihăilă
raul.mihaila at gmail.com
Sat Aug 6 19:09:43 UTC 2016
Initially posted on github (https://github.com/tc39/ecma262/issues/652),
but I think the mailing list is more appropriate.
Usually methods on Object that change some internal state of the
objects/properties of the objects either succeed or throw. However,
Object.freeze can fail to freeze proxies without throwing:
```js
const target = Object.seal({x: 2});
const proxy = new Proxy(target, {
defineProperty() {
return true;
},
set(target, prop, value) {
target[prop] = value;
}
});
Object.freeze(proxy);
console.log(proxy.x); // 2
proxy.x = 100;
console.log(proxy.x); // 100
```
Should this be allowed?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160806/c5c28d0a/attachment.html>
More information about the es-discuss
mailing list