Created
August 8, 2015 14:02
-
-
Save nathanmarz/b3cf61e89e351cf60f33 to your computer and use it in GitHub Desktop.
Protocol functions and metadata do not play well together
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])) | |
(def tester-with-meta (with-meta tester {:a 1})) | |
(extend-protocol TestProtocol | |
String | |
(tester [o] (println "Strings work!"))) | |
(tester-with-meta "A") ;; Error | |
(tester "A") ;; Works fine | |
(def tester-with-meta (with-meta tester {:a 1})) | |
(extend-protocol TestProtocol | |
Long | |
(tester [o] (println "Longs work!"))) | |
(tester-with-meta "A") ;; Works fine | |
(tester-with-meta 3) ;; Error |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment