forbes at lindesay.co.uk (2017-01-08T05:26:57.955Z)
With the advent of Proxy in ES2015, getOwnPropertyDescriptor can always
have side-effects:
```js
Object.getOwnPropertyDescriptor(
new Proxy({}, {
getOwnPropertyDescriptor() {
throw "hello world"
}
}),
"foo"
)
```
With the advent of Proxy in ES2015, getOwnPropertyDescriptor can always have side-effects: Object.getOwnPropertyDescriptor(new Proxy({}, { getOwnPropertyDescriptor() { throw "hello world" } }), "foo") On Fri, Jan 6, 2017 at 11:11 AM, Francisco Tolmasky <tolmasky at gmail.com> wrote: > Is there any position on whether getOwnPropertyDescriptor should not have > side-effects? I ask because some v8 getOwnPropertyDescriptor *do* have side > effects (for example, Object.getOwnPropertyDescriptor(new Error, “stack”) > will call Error.prepareStackTrace (it used to not)). Currently I > treat getOwnPropertyDescriptor as a “safe” way to observe an object — > (unlike say calling each member on an object which could set off getters). > > -- > Francisco Tolmasky > www.tolmasky.com > tolmasky at gmail.com > > _______________________________________________ > 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/20170106/33031db9/attachment.html>