Skip to content

Instantly share code, notes, and snippets.

@nathanmarz
Created August 8, 2015 14:02
Show Gist options
  • Save nathanmarz/b3cf61e89e351cf60f33 to your computer and use it in GitHub Desktop.
Save nathanmarz/b3cf61e89e351cf60f33 to your computer and use it in GitHub Desktop.
Protocol functions and metadata do not play well together
(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