2012/10/9 Mark S. Miller <[email protected]>

> On Tue, Oct 9, 2012 at 6:25 AM, David Bruant <[email protected]> wrote:
>
>> In a way, what I'm asking is to make dummy target "official" and more
>> restricted, by not allowing arbitrary objects, but only proxies with the
>> actual target in their target chain.
>>
>
> Making them more official and restricted sounds promising. But if I
> understand the rest of your sentence, what you're suggesting is not more
> restricted, it's differently restricted. And the way it is less restricted
> is, IMO, bad.
>

To make matters more concrete, one way in which the chaperone-approach
would differ visibly from the current state has to do with caching. As Mark
said, the invariants related to getPrototypeOf and frozen properties have
more to do with stability than with identity.

Valid approach today:

var desc = Object.getOwnPropertyDescriptor(obj, "foo");
// assume "foo" is a data property
if (!desc.configurable && !desc.writable) {
  var cached = obj.foo;
  /* from now on, can reliably use cached instead of obj.foo */
}

If we would relax the frozen property get invariant, if obj is a proxy,
obj.foo could evaluate to a different proxy (admittedly to the same target)
even though "foo" is non-configurable, non-writable. This can lead to
observably different behavior.

(getPrototypeOf is analogous)

Cheers,
Tom
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to