-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Proxy target and handler to be Proxy too #1947
base: master
Are you sure you want to change the base?
Conversation
8471522
to
9d9fd80
Compare
I’m actually a bit surprised they allow a Proxy for the handler. Proxy-of-Proxy makes some sense, but a Proxy’d handler doesn’t seem as useful. |
I think it's just allowed by default: it's not explicitly rejected even though it may not be very useful in practice. |
Yeah, makes sense. It just seems like something that might want to be rejected explicitly simply to avoid all the potential edge cases it creates. But thinking about it, I suppose that the same pitfalls apply to recursive proxies so disallowing a Proxy as handler doesn’t really buy you anything in that regard. |
In practice the main difficulties for Duktape would be:
There may be more corner cases here and there though. |
9d9fd80
to
7a5fa23
Compare
Up to now Duktape has intentionally rejected a Proxy as either a Proxy target or a Proxy handler object; both cases cause more potential for native recursion and are relatively rare in practice. ES2015+ does not place such a limitation on Proxies. This pull removes the current limitation and allows Proxies as both target and handler.
Tasks:
This is currently work in progress, to be merged after 2.3.