Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Errors by
retagged by
user=> (defmulti thing)
#'user/thing
user=> (defmethod thing :default [x] :hi)
#object[clojure.lang.MultiFn 0x7b60c3e "clojure.lang.MultiFn@7b60c3e"]
user=> (thing :hello)
Execution error (NullPointerException) at user/eval144 (REPL:1).
null
user=>

Someone was surprised by this behavior and missed the error that there was no dispatch function defined. Notable that there is some validation for defmulti:

 (defmulti thing [x] (fn [x] x))
Syntax error macroexpanding defmulti at (REPL:1:1).
The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)
user=>

2 Answers

+1 vote
by
selected by
+1 vote
by

Covered by existing spec enhancement https://clojure.atlassian.net/browse/CLJ-2416

...