July TC39 meeting notes, day 1
rossberg at google.com
Tue Aug 9 01:17:41 PDT 2011
On 8 August 2011 18:46, Kevin Reid <kpreid at google.com> wrote:
> On Mon, Aug 8, 2011 at 08:50, Andreas Rossberg <rossberg at google.com> wrote:
>> I would welcome removing the extra receiver (or proxy) arguments from
>> get and set traps. However, it seems to me that the main reason,
>> currently, for having them is that they are needed by the default
>> traps, in case the respective descriptor returned by
>> getOwnPropertyDescriptor has a getter/setter (which need a receiver).
> This is almost the rationale I gave earlier. To be precise, the
> default traps themselves need not have behavior which is implementable
> as an explicit trap (since they are not exposed as being functions
> which take the same parameters as user-supplied traps do). I feel the
> receiver should be provided so that user-supplied traps *can mimic the
> default traps*, with variations or optimizations.
>> Arguably, making a proxy trap return getters/setters seems a somewhat
>> pointless use case anyway. But nevertheless we need to have some
>> reasonable semantics for it.
> It allows a proxy to pretend to be an object which supports
> Object.defineOwnProperty normally.
> It allows a proxy to emulate, or wrap, an ordinary object which
> happens to have some accessor properties, while still being
> transparent to reflection (which I understand is one of the goals of
> the proxy facility).
Sure, but is that necessarily something that the _default_ traps have
to be able to mimic? There is no problem programming it up yourself if
you want it.
I'm not saying yes or no, just raising the question. At least the
additional arguments seem like a significant complication (and
asymmetry) to the proxy interface for very limited benefit.
More information about the es-discuss