July TC39 meeting notes, day 1

Brendan Eich brendan at mozilla.com
Fri Jul 29 23:25:05 PDT 2011

On Jul 29, 2011, at 10:31 PM, Kevin Reid wrote:

> On Fri, Jul 29, 2011 at 19:57, Brendan Eich <brendan at mozilla.com> wrote:
>> The good news: the proxy traps as proposed are unchanged. Hats off to Tom
>> and Mark for nailing that API and minimizing its parameterization!
>> Proxies have two prototype implementations now: Firefox since 4, and now V8
>> (http://code.google.com/p/v8/source/detail?r=8733) -- not sure when that
>> shows up under a flag in Chrome canaries, someone from Google will know.
> Just to clarify: “as proposed” = the current version of
> <http://wiki.ecmascript.org/doku.php?id=harmony:proxies>? That is,
> will the proxy parameter remain first, rather than last?

It's the receiver parameter for get and set in the spec, but yes: first.

Again, we went through a path that added proxy at the end:

  get: function (receiver, name, proxy) {...}

and then Sean pointed out how receiver and proxy can only ever denote the same object.

If the trapping proxy is directly referenced, there is no prototype object that might differ and the proxy's get trap is called with receiver = proxy.

If the trapping proxy is on the prototype chain of some native object O, then because of how ES5 works, the proxy's get trap is not invoked. As Sean wrote:

ES5 section 8.12.3 step [1 in ES5.1] calls
[[GetProperty]] on the receiver, causing a [[GetProperty]] (not
[[Get]]) call to propagate up the prototype chain, meaning the proxy's
"getPropertyDescriptor" (not "get") trap is called.


So the get trap is not invoked on the proto-proxy, rather the getPropertyDescriptor trap is invoked.

We can rename receiver to proxy and clarify this with a note, for sure.


More information about the es-discuss mailing list