Skip to content

Instantly share code, notes, and snippets.

@timsgardner
Last active October 6, 2016 01:41
Show Gist options
  • Save timsgardner/be31684a495778ab7095d6ccf0fc0b6c to your computer and use it in GitHub Desktop.
Save timsgardner/be31684a495778ab7095d6ccf0fc0b6c to your computer and use it in GitHub Desktop.
protocols test
(defprotocol IBlubso
(flubmo [this]))
(def c1 (clojure.lang.RT/classForName "user.IBlubso"))
(defn blubber []
(reify user.IBlubso
(flubmo [this]
:hi-there)))
(flubmo (blubber))
;; =>
;; :hi-there
(defprotocol IBlubso
(flubmo [this]))
(def c2 (clojure.lang.RT/classForName "user.IBlubso"))
(flubmo (blubber))
;; =>
;; System.NullReferenceException: Object reference not set to an instance of an object..
(= c1 c2)
;; false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment