Closed Bug 643100 Opened 13 years ago Closed 12 years ago

add receiver object to all proxy traps that need it, and pass the proxy itself as final (optional) argument

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: gal, Assigned: gal)

References

Details

Attachments

(1 file)

There is currently no way to reach the receiver object, which severely limits the ability of proxies to be used on the proto chain of objects. If traps need the handler they can close over it, whereas there is no alternative way to get to the receiver object.

This blocks self-hosted WebIDL bindings.
Depends on: 643101
We have been discussing this issue on es-discuss. It has led to the following strawman: http://wiki.ecmascript.org/doku.php?id=strawman:handler_access_to_proxy
(adding an argument which value is the proxy to all traps).
The 'this' binding to the handler is used in derived traps in order to implement default trap behavior.

Are you suggesting the binding should occur only during trap calls or that the proxy replaces the handler functions by bound functions at init time or anything like that?
Summary: in proxy traps, bind 'this' to the receiver object, not the handler → add receiver object to all proxy traps that need it, and pass the proxy itself as final (optional) argument
Attached patch patchSplinter Review
Assignee: general → gal
Attachment #522903 - Flags: review?(jorendorff)
Comment on attachment 522903 [details] [diff] [review]
patch

Clearing ancient review flag. Last I heard about this was a quick "don't review that yet" in passing from gal, in Santa Cruz, months ago.
Attachment #522903 - Flags: review?(jorendorff)
An interesting point has been made on es-discuss leading to http://wiki.ecmascript.org/doku.php?id=strawman:proxy_drop_receiver
In conjunction with http://wiki.ecmascript.org/doku.php?id=strawman:handler_access_to_proxy
it would mean that:
- All traps get an optional final "proxy" argument which value is the proxy the trap is being called on.
- No receiver argument anywhere anymore.
A decision may be made at the TC39 July meeting.
No longer blocks: harmony:proxy
Marking this bug as invalid since it is not relevant with the direct proxies design.
Feel free to change the status if I'm mistaken.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: