Created
January 18, 2012 07:06
-
-
Save hozumi/1631670 to your computer and use it in GitHub Desktop.
Multimethods bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defmulti foo (fn [x] x)) | |
;=> #<[object Object]> | |
(defmethod foo ::a [x] "a!") | |
;=> #<[object Object]> | |
; Hierarchy setting | |
(derive ::a1 ::a) | |
;=> nil | |
; works well | |
(foo ::a1) | |
;=> "a!" | |
;; add another method | |
(defmethod foo ::b [x] "b!") | |
;=> #<[object Object]> | |
; error! | |
(foo ::a1) | |
; "Error evaluating:" (foo :cljs.user/a1) :as "cljs.user.foo.call(null,\"?'cljs.user/a1\");\n" | |
; #<Error: No method in multimethod 'function name(x){ | |
; if(cljs.core.truth_(cljs.core.string_QMARK_.call(null,x))) | |
; {return x; | |
; } else | |
; {if(cljs.core.truth_((function (){var or__3548__auto____7059 = cljs.core.keyword_QMARK_.call(null,x); | |
; | |
; if(cljs.core.truth_(or__3548__auto____7059)) | |
; {return or__3548__auto____7059; | |
; } else | |
; {return cljs.core.symbol_QMARK_.call(null,x); | |
; } | |
; })())) | |
; {var i__7060 = x.lastIndexOf("/"); | |
; | |
; if(cljs.core.truth_((i__7060 < 0))) | |
; {return cljs.core.subs.call(null,x,2); | |
; } else | |
; {return cljs.core.subs.call(null,x,(i__7060 + 1)); | |
; } | |
; } else | |
; {if(cljs.core.truth_("?'else")) | |
; {throw (new Error(cljs.core.str.call(null,"Doesn't support name: ",x))); | |
; } else | |
; {return null; | |
; } | |
; } | |
; } | |
; }' for dispatch value: ?'cljs.user/a1> | |
; Error: No method in multimethod 'function name(x){ | |
; if(cljs.core.truth_(cljs.core.string_QMARK_.call(null,x))) | |
; {return x; | |
; } else | |
; {if(cljs.core.truth_((function (){var or__3548__auto____7059 = cljs.core.keyword_QMARK_.call(null,x); | |
; | |
; if(cljs.core.truth_(or__3548__auto____7059)) | |
; {return or__3548__auto____7059; | |
; } else | |
; {return cljs.core.symbol_QMARK_.call(null,x); | |
; } | |
; })())) | |
; {var i__7060 = x.lastIndexOf("/"); | |
; | |
; if(cljs.core.truth_((i__7060 < 0))) | |
; {return cljs.core.subs.call(null,x,2); | |
; } else | |
; {return cljs.core.subs.call(null,x,(i__7060 + 1)); | |
; } | |
; } else | |
; {if(cljs.core.truth_("?'else")) | |
; {throw (new Error(cljs.core.str.call(null,"Doesn't support name: ",x))); | |
; } else | |
; {return null; | |
; } | |
; } | |
; } | |
; }' for dispatch value: ?'cljs.user/a1 | |
; at do_invoke (http://localhost:8080/cljs/cljs/core.js:11186:9) | |
; at [object Object].cljs$core$IMultiFn$_invoke (http://localhost:8080/cljs/cljs/core.js:11283:28) | |
; at _invoke (http://localhost:8080/cljs/cljs/core.js:11162:12) | |
; at [object Object].<anonymous> (http://localhost:8080/cljs/cljs/core.js:11287:26) | |
; at [object Object].call (http://localhost:8080/cljs/cljs/core.js:11294:26) | |
; at eval at <anonymous> (http://localhost:8080/cljs/clojure/browser/repl.js:21:158) | |
; at eval at <anonymous> (http://localhost:8080/cljs/clojure/browser/repl.js:21:158) | |
; at http://localhost:8080/cljs/clojure/browser/repl.js:21:153 | |
; at evaluate_javascript (http://localhost:8080/cljs/clojure/browser/repl.js:33:3) | |
; at Object.callback (http://localhost:8080/cljs/clojure/browser/repl.js:115:126) | |
; nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment