Skip to content
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

Cleaner ES6 Proxy implementation #178

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marshall007
Copy link
Contributor

Supersedes #95 and eliminates a lot of the pitfalls I ran into with that first implementation. However, as discussed in #95, we still cannot do proxy instanceof Term directly. This is because the current implementation of Proxy in Node is not up to specification, nor is the appropriate behavior shimmed by harmony-reflect, as noted in their docs:

In full ES6 proxies, it is the intent that this trap is also triggered for proxy instanceof Function. This shim does not currently intercept that operation.

In the mean time, Term.isTerm checks for proxy._self instanceof Term which is nicer than setting a flag on the object as I was doing before. Once Proxy is fully implemented or shimmed up to spec, we can get rid of this and correctly trap the instanceof call.

TODO:

  • Check that Proxy is defined globally (i.e. available in current environment). If not, use existing behavior by modifying __proto__.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant