Skip to content

Instantly share code, notes, and snippets.

@kurogelee
Created April 20, 2014 23:03
Show Gist options
  • Save kurogelee/11127509 to your computer and use it in GitHub Desktop.
Save kurogelee/11127509 to your computer and use it in GitHub Desktop.
Clojureでproxyオブジェクトにメタ情報を付与する ref: http://qiita.com/kurogelee/items/ef22826be3577292526f
(def v (proxy [Object] []
(toString [] (str :abc))))
(with-meta v {:A 111})
java.lang.ClassCastException: user.proxy$java.lang.Object$ff19274a cannot be cast to clojure.lang.IObj
(def v (proxy [Object clojure.lang.IObj] []
(toString [] (str :abc))
(withMeta [m] (update-proxy this {"meta" (fn [this] m)}))
(meta [] nil)))
(with-meta v {:A 111})
(meta v)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment