Hi, so I am currently trying to port some code to graalvm, sadly this code uses a lot of (resolve (symbol))
my guess its a no go for graalvm ?
@roguas Resolve is ok as long as it is compile time. I.e.: top level.
Example of resolves that do work: https://github.com/borkdude/babashka/blob/master/src/babashka/main.clj#L41-L54
sadly its not 🙂 its dynamic based on string val
but the items are already in place, so Im thinking there is chance to tell graal to have them loaded
can you change the code to use a map lookup instead of resolve? - worth a try if resolve itself doesn't work
ok, not super advanced with clojure, but if I get it right, the proposition is to
(defn some-string [x] (x))
; replace this ...
((resolve (symbol "some-string")) "identity string")
; with this ...
(def function-map {:some-string some-string})
((:some-string function-map) "identity string")
?basically yes. - if resolve does not work
using this map will also make GraalVM hold on to the function reference
it's also how I do it in sci: https://github.com/borkdude/sci/blob/d9e98bea679b8120a990a6cf81de5cfdca40ab1b/src/sci/impl/namespaces.cljc#L510