Ok, it seems I cannot make it work unless the "get-method" for protocol is available,
The reason is, in the example by Michal, the return value from "(get-in IFoo [:impls user.Bar :foo])" is a Java function, not a true Clojure function with true dynamic typing. So, take the same example: (defprotocol IFoo (foo [x])) (deftype Bar [a]) (extend-protocol IFoo Bar (foo [x] (.a x))) (get-in IFoo [:impls user.Bar :foo]) => #<user$eval39$fn__40 user$eval39$fn__40@30c06258> ;; But, the function returned does not work on another type (deftype Par [a]) ((get-in IFoo [:impls user.Bar :foo]) (Par. 10)) => java.lang.ClassCastException (user.Par cannot be cast to user.Bar) So this seems a dead end. Will need to wait until get-method is available. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en