I'm getting an error when trying to call a multimethod in a certain scenario. I'm unfortunately not able to reproduce this when running it as a test case with v8. But, I was able to trim it down to the following test case which fails for me in a browser (with a connected repl).
(defmulti foo (fn [a b] [(:foo a) (:foo b)])) (defmethod foo [:foo :bar] [a b] :foobar) (defmethod foo :default [a b] :default) ;; this fails with an error - expecting default case (foo {} {}) ;; succeeds -> :foobar (foo {:foo :foo} {:foo :bar}) However, with slight modifications, it works for me. (defmulti bar (fn [& args] (vec (map :foo args)))) (defmethod bar [:foo :bar] [a b] :foobar) (defmethod bar :default [a b] :default) ;; succeeds -> default case (bar {} {}) Interestingly enough, it works with this variation too: (defmulti baz (fn [a b] (vector (:foo a) (:foo b)))) (defmethod baz [:foo :bar] [a b] :foobar) (defmethod baz :default [a b] :default) ;; also succeeds -> default case (baz {} {}) The error that I'm getting when it fails is: obj is undefined return obj[goog.UID_PROPERTY_] || (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_ (This is in the definition of goog.getUid) I tried to debug a little bit, and it looks like it's failing when looking up the multimethod in the cache. The obj is undefined at that point. Robert -- 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