Fork me on GitHub

Anyone have a clue why I get error Could not resolve symbol: clojure.lang.PersistentList ? When doing

(def rop-dep '{:deps {rop/rop {:mvn/version "0.4.1"}}})
  (def cp (-> (sh "clojure" "-Spath" "-Sdeps" (str rop-dep)) :out s/trim))
  (add-classpath cp)
  (require '[rop.core :as rop])


This is because not all classes are explicitly available for interop in babashka, they have to be manually added. Which library is this? (I'll be back in a bit)

🙏 3

@mozinator You're welcome to post an issue about this.

👍 3

Maybe the rop and cats library might be too heavyweight for babashka scripts anyway. I found this solution to error handling which seems to cover most of what I need


@borkdude what are your criteria for adding libraries to the included libraries in babashka ?


camel-snake-kebab has been asked at least one time before. I'm willing to add it if more people ask for it in an issue.


But since that lib can also be ran from source, there might not be a need to include it in babashka proper. This can be discussed in an issue though. So making an issue would be the first step.

👍 6

I was trying out slingshot btw:

$ bb -e "(require '[slingshot.slingshot :as s]) (s/try+ (s/throw+ {:type ::foo}) (catch [:type ::foo] [] 1)))"
----- Error --------------------------------------------------------------------
Type:     java.lang.ClassNotFoundException
Message:  clojure.lang.RT
Location: <expr>:1:40

----- Context ------------------------------------------------------------------
1: (require '[slingshot.slingshot :as s]) (s/try+ (s/throw+ {:type ::foo}) (catch [:type ::foo] [] 1)))
                                          ^--- clojure.lang.RT
I'm not sure why this error appears, since I see no mention of clojure.lang.RT in the source code of slingshot


I'll also make an issue for that.


Ah, found the issue. Not sure why this is happening.

$ bb -e '(alength (into-array []))'
----- Error --------------------------------------------------------------------
Type:     java.lang.ClassNotFoundException
Message:  clojure.lang.RT
Location: <expr>:1:1

----- Context ------------------------------------------------------------------
1: (alength (into-array []))
   ^--- clojure.lang.RT


Maybe this uses reflection in Clojure?

(defn alength
  "Returns the length of the Java array. Works on arrays of all
  {:inline (fn [a] `(. clojure.lang.RT (alength ~a)))
   :added "1.0"}
  [array] (. clojure.lang.RT (alength array)))



user=> (. clojure.lang.RT (alength (into-array [])))
Reflection warning, NO_SOURCE_PATH:1:1 - call to static method alength on clojure.lang.RT can't be resolved (argument types: unknown).

borkdude20:12:34 > Obviously, you have ClojureScript compiling JavaScript, which was something that we started and led at the beginning, but is now led primarily outside of Cognitect by David Nolan and others. And then, a variety of other dialects and things that people are doing like the babashka for shell scripting in Clojure and those kinds of things.

babashka 30
borkdude22:12:46 <- the com.stuartsierra/dependency lib works with bb

🎉 12