Created
August 8, 2015 15:50
-
-
Save nathanmarz/05b564321a46338a3cab to your computer and use it in GitHub Desktop.
Protocol functions fail to find extensions is assigned to locals or other var
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defprotocol TestProtocol | |
(tester [o])) | |
(let [t tester] | |
(defn another-tester [o] | |
(t o))) | |
(def another-tester2 tester) | |
(extend-protocol TestProtocol | |
String | |
(tester [o] (println "Strings work!"))) | |
(another-tester "A") ;; Error | |
(another-tester2 "A") ;; Error | |
(tester "A") ;; Works fine | |
(let [t tester] | |
(defn another-tester [o] | |
(t o))) | |
(another-tester "A") ;; Works fine | |
(def another-tester2 tester) | |
(another-tester2 "A") ;; Works fine | |
(extend-protocol TestProtocol | |
Long | |
(tester [o] (println "Longs work!"))) | |
(another-tester "A") ;; Works fine | |
(another-tester 3) ;; Error | |
(another-tester2 3) ;; Error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment