Spec bug (proxies)? 9.5.8 [[Get]] (P, Receiver)
No, the proxy invariant checking mechanism never looks at inherited
properties. Invariants related to frozenness (non-configurable,
non-extensible) relate only to own properties. For example, even if an
object is frozen, it may still inherit from a non-frozen object whose
interface may change. And then there's setPrototypeOf
, which may cause
inherited properties to change altogether.
OK. It surprised me, because get
is so much about inheritance chains.
I’ve not seen a rationale for the proxy invariants anywhere (including your technical report on proxies). Can I read up on it somewhere?
In general, the proxy parts of the spec are very readable. Especially the summary of the invariants in each section on internal proxy properties is helpful.
2014-11-02 22:10 GMT+01:00 Axel Rauschmayer <axel at rauschma.de>:
OK. It surprised me, because
get
is so much about inheritance chains.I’ve not seen a rationale for the proxy invariants anywhere (including your technical report on proxies). Can I read up on it somewhere?
Do you mean the rationale for looking only at "own" properties, or more generally the rationale behind invariant checking in proxies? If the latter, then the best rationale is written up in our ECOOP13 paper Trustworthy proxies: virtualising objects with invariants research.google.com/pubs/pub40736.html. If the former, this is
kind of self-evident when looking at the invariants already described in ES5 (in particular, section 8.6.2 ecma-international.org/ecma-262/5.1/#sec-8.6.2).
Non-configurability and non-extensibility never involve the prototype chain. They only apply to individual own properties or individual objects, never to prototype chains of objects.
In general, the proxy parts of the spec are very readable. Especially the summary of the invariants in each section on internal proxy properties is helpful.
Thanks! (credit also goes to AllenWB and MarkM for refining those invariants)
people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver, people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy-object-internal-methods-and-internal-slots-get-p-receiver
To enforce the invariants, this operation uses
targetDesc
. That property descriptor is retrieved via target.[[GetOwnProperty]], which ignores inherited properties. Shouldn’t inherited properties be taken into consideration, too?