The following code fails with a strange exception "No matching field found: _GT_foobar for class user.MyFoobar":
> (defprotocol Foobar > (->foobar [this])) > (defrecord MyFoobar [value] > Foobar > (->foobar [this] (str "Foobar:" value))) > (extend-protocol Foobar > String > (->foobar [this] (str "Foobar:" this))) > (println (map ->foobar ["1" "a"])) > (println (map #(->foobar %) [(MyFoobar. 1) (MyFoobar. "a")])) > ; the following call crashes. > (println (map ->foobar [(MyFoobar. 1) (MyFoobar. "a")])) The result: [~]$ clojure foobar.clj > (Foobar:1 Foobar:a) > (Foobar:1 Foobar:a) > (Exception in thread "main" java.lang.IllegalArgumentException: No > matching field found: _GT_foobar for class user.MyFoobar > at clojure.lang.Reflector.getInstanceField(Reflector.java:271) > at > clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:300) > at user$eval10$fn__11$G__2__13.invoke(foobar.clj:1) > at user$eval10$fn__11$G__1__16.invoke(foobar.clj:1) > at clojure.core$map$fn__4087.invoke(core.clj:2432) > at clojure.lang.LazySeq.sval(LazySeq.java:42) > at clojure.lang.LazySeq.seq(LazySeq.java:60) > at clojure.lang.RT.seq(RT.java:473) > at clojure.core$seq.invoke(core.clj:133) > at clojure.core$print_sequential.invoke(core_print.clj:46) > at clojure.core$fn__5270.invoke(core_print.clj:140) > at clojure.lang.MultiFn.invoke(MultiFn.java:167) > at clojure.core$pr_on.invoke(core.clj:3266) > at clojure.core$pr.invoke(core.clj:3278) > at clojure.lang.AFn.applyToHelper(AFn.java:161) > ... It only fails with records that implement the protocol inline. It's also OK if the "->" part is in the middle of the method name, like "aaa->foobar". I'm wondering if this is a issue or there is something I don't know about these special function names. P.S. My clojure version is 1.4.0. -- 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