On Mon, Aug 8, 2011 at 08:50, Andreas Rossberg <[email protected]> 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). (As it happens, this doesn't affect the use case which made me notice this problem; there, I am defining an emulation of DOM nodes (i.e. the accessors are such things as .innerHTML), and DOM nodes, being host objects, are allowed to do anything, I am given to understand. However, it is convenient to define my emulations as ordinary objects, which are incidentally wrapped by a proxy to implement the particularly magical parts.) _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

