can I vote somewhere to make MultiFns more inspectable? Like making it's name
field public so I can write my own print-method for them that gives me hint what that function is
Can you back up to the problem you’re having and describe it?
The problem is I want to understand values at the repl. When I have fns in repl output, I can get some understanding of what values it refers to. For example, seeing "#object[clojure.core$inc 0x63bca84d \"clojure.core$inc@63bca84d\"]"
I know this is clojure.core/inc
. This is not the case for MultiFns, since they are displayed as "#object[clojure.lang.MultiFn 0x250a946 \"clojure.lang.MultiFn@250a946\"]"
without any hint to what they are about.
you can name the defmethod
how?
user=> (defmulti foo identity)
#'user/foo
user=> (defmethod foo 1 foo-one [x] (throw (Exception. "")))
#object[clojure.lang.MultiFn 0x32c8e539 "clojure.lang.MultiFn@32c8e539"]
user=> (foo 1)
Execution error at user/eval140$foo-one (REPL:1).
I mean I know, I can make name
field accessible using reflection and read it, but this feels brittle
your error does not have foo
in output
it has foo-one
you can name it on a per method basis
I want to know the multifn itself, not their component
and I would prefer to see it when I print it, not in an exception it throws: do I have to guess args to pass it so it throws?
there are some multimethod tickets out there, I'm not sure if this is one of them
right, I see -- maybe that's an enhancement request then, including the defmulti name in the multimethod toString
should I request it on http://ask.clojure.org?
https://clojure.atlassian.net/browse/CLJ-2419 looks similar
that's probably the closest one I can see
I added your comment above to that ticket
thanks!
tweaked the title too