Fork me on GitHub
#graalvm
<
2020-05-11
>
rmxm12:05:02

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 ?

borkdude13:05:15

@roguas Resolve is ok as long as it is compile time. I.e.: top level.

rmxm13:05:26

sadly its not 🙂 its dynamic based on string val

rmxm13:05:59

but the items are already in place, so Im thinking there is chance to tell graal to have them loaded

borkdude13:05:14

can you change the code to use a map lookup instead of resolve? - worth a try if resolve itself doesn't work

rmxm14:05:53

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")
?

borkdude15:05:45

basically yes. - if resolve does not work

borkdude15:05:22

using this map will also make GraalVM hold on to the function reference