Closed shark8me closed 6 years ago
@shark8me There's probably something related to your project setup that's involving java.util.Map
rather than persistent-map. Can you try running the following at the REPL before doing whatever that caused the error?
(import 'java.util.Map)
(import 'clojure.lang.IDeref)
(prefer-method print-method Map IDeref)
@kumarshantanu
The error isn't seen if I run the imports you described. So what's the solution? Importing java.util.Map?
I think the issue can be fixed in promenade by preferring print-method
for Map
(instead of IPersistentMap
) over IDeref
. @shark8me Can you share a minimal example that can reproduce the issue?
@shark8me Alternatively, you can put an equivalent of this snippet in your project and execute at startup:
(import 'java.util.Map)
(import 'clojure.lang.IDeref)
(prefer-method print-method Map IDeref)
by "minimal example", do you mean an entire project (along with the project.clj), or just the source. If it is just the source, then its :
(prom/fail {:some :a})
Sure, I can live with the workaround you suggested.
OK, I can reproduce the issue with Clojure 1.7.0 in the promenade repo as follows:
$ lein do clean, with-profile c17 repl
user=> (require '[promenade.core :as prom])
nil
user=> (prom/fail {:some :a})
IllegalArgumentException Multiple methods in multimethod 'print-method' match dispatch value: class promenade.internal.Failure -> interface java.util.Map and interface clojure.lang.IDeref, and neither is preferred clojure.lang.MultiFn.findAndCacheBestMethod (MultiFn.java:178)
Thanks for reporting, @shark8me - will have a fix ready soon.
For posterity w.r.t. CLJS: https://stackoverflow.com/a/42917425/188505
@shark8me This issue is fixed in version 0.5.1
- thanks again!
@kumarshantanu That works :). Thanks for the quick resolution! :+1:
Hi!
I've been using Promenade for some time, and find it quite useful, thanks for writing it :).
I've observed one issue (which isn't a bug, more like a repl-interface niggle).
gives
I'm using Spacemacs, and promenade version 0.5.0. Any suggestions why this isn't kicking in?