Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to and GraalVM slack:
rmxm 2020-05-11T12:12:02.236400Z

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 ?

borkdude 2020-05-11T13:26:15.236800Z

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

borkdude 2020-05-11T13:27:11.237200Z

Example of resolves that do work:

rmxm 2020-05-11T13:28:26.237700Z

sadly its not 🙂 its dynamic based on string val

rmxm 2020-05-11T13:28:59.238300Z

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

borkdude 2020-05-11T13:35:14.239100Z

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

rmxm 2020-05-11T14:55:53.242500Z

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

borkdude 2020-05-11T15:11:45.243100Z

basically yes. - if resolve does not work

borkdude 2020-05-11T15:12:22.243500Z

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