Skip to content

Instantly share code, notes, and snippets.

@schmir
Created June 20, 2014 10:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schmir/ca3aebd543811c589068 to your computer and use it in GitHub Desktop.
Save schmir/ca3aebd543811c589068 to your computer and use it in GitHub Desktop.
(ns sandbox.core)
(defprotocol GetUserData
"get user data"
(getUserData [this] "get user data"))
(def d (proxy [Object sandbox.core.GetUserData] []
(getUserData [] 42)))
;; sandbox.core=> (getUserData d)
;; 42
;; sandbox.core=> (use 'sandbox.core :reload)
;; nil
;; sandbox.core=> (getUserData d)
;; IllegalArgumentException No implementation of method: :getUserData of protocol: #'sandbox.core/GetUserData found for class: sandbox.core.proxy$java.lang.Object$GetUserData$ea9a2492 clojure.core/-cache-protocol-fn (core_deftype.clj:544)
;; sandbox.core=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment