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

Capture Binding Symbols Should Shadow Global Symbols in Predicates #8

Closed
alexanderkiel opened this issue Feb 6, 2018 · 0 comments
Closed

Comments

@alexanderkiel
Copy link
Owner

The following phraser doesn't work because key is a function in clojure.core and most namespaces import it:

(defphraser #(contains? % key)
  [_ _ key]
  (format "Missing %s." (name key)))

The intended behaviour is to use key as symbol to capture the actual key of the contains? predicate. The problem is that the current symbol resolution tries to resolve all symbols first and only leave the symbol alone if it fails. The solution is to not resolve capture binding symbols. The result is that key in the predicate is actually in scope of the phraser and not in global scope.

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

No branches or pull requests

1 participant