babashka

jyn 2025-07-31T18:25:15.453519Z

hi! this is not exactly a babashka question but i'm not sure where else to ask. i am getting this error when clojure tries to print another unrelated error:

Exception in thread "main" java.lang.IllegalArgumentException: Multiple methods in multimethod 'simple-dispatch' match dispatch value: class babashka.process.Process -> interface clojure.lang.IPersistentMap and interface clojure.lang.IDeref, and neither is preferred
i think this is because there is a bug in babashka.Process's toString impl? i am not quite sure how to debug it

jyn 2025-07-31T18:26:41.393229Z

here's a backtrace: https://gist.github.com/jyn514/25f823335ddfae33b494fa2501bd4b20

borkdude 2025-07-31T18:28:57.460959Z

require the namespace babashka.process.pprint and the problem will go away

borkdude 2025-07-31T18:29:03.065389Z

in your host

jyn 2025-07-31T18:29:09.956339Z

oh wild

jyn 2025-07-31T18:29:22.927019Z

that tells the clojure runtime to give precedence to babashka.pprint, i guess?

jyn 2025-07-31T18:30:17.163549Z

yes that fixed it

jyn 2025-07-31T18:30:19.595729Z

thank you!

borkdude 2025-07-31T18:30:22.181769Z

you can check the source to see what it does :)

😄 1
jyn 2025-07-31T18:31:22.263119Z

why is it a separate namespace? why not include it in babashka.process?

borkdude 2025-07-31T18:32:22.264649Z

I wanted to make babashka.process not force users to load clojure.pprint in their runtime

jyn 2025-07-31T18:33:30.300829Z

oh i see, because this could be an SCI guest and now Graal has to include it in the native image?

borkdude 2025-07-31T18:33:34.686689Z

clojure.pprint can cause quite large graalvm binaries because there's dynamic find-var usage here: https://github.com/clojure/clojure/blob/da1c748123c80fa3e82e24fc8e24a950a3ebccd9/src/clj/clojure/pprint/pprint_base.clj#L148

jyn 2025-07-31T18:33:39.509929Z

gotcha

borkdude 2025-07-31T18:33:56.415069Z

this is also why I have some patches for clojure.pprint in babashka

👍 1