graalvm

Discuss GraalVM related topics. Use clojure 1.10.2 or newer for all new projects. Contribute to https://github.com/clj-easy/graal-docs and https://github.com/BrunoBonacci/graalvm-clojure. GraalVM slack: https://www.graalvm.org/slack-invitation/.
dharrigan 2020-12-26T11:16:58.242700Z

What's the state of graalvm (20.3.0) and any clojure programs that do a requiring-resolve?

dharrigan 2020-12-26T11:17:10.242900Z

Is it known to work?

borkdude 2020-12-26T11:33:32.243800Z

@dharrigan requiring-resolve = require + resolve, both are problematic when used in a dynamic fashion. you should try to get rid of these and do require + resolve only on the top level (not in function bodies)

dharrigan 2020-12-26T11:34:08.244600Z

Thank you. Unfortunately, can't easily do that. I'm using juxt clip to manage some dependencies, and it uses requiring-resolve

dharrigan 2020-12-26T11:34:22.245200Z

A pity, for because the first time today I managed to get my entire app to compile

borkdude 2020-12-26T11:34:24.245500Z

they do work when you put a top-level require before those are executed (but they will lead to slightly more bloated binaries)

dharrigan 2020-12-26T11:34:30.245700Z

(using rc1 of clojure)

dharrigan 2020-12-26T11:34:54.246100Z

Was excited, until it tried to load in a clojure file and it fell over 😞

borkdude 2020-12-26T11:35:20.246400Z

@dharrigan you want to execute clojure dynamically in a graalvm binary?

borkdude 2020-12-26T11:35:37.246800Z

this is what I've made sci for: https://github.com/borkdude/sci

dharrigan 2020-12-26T11:36:04.247600Z

More like I have a system that uses juxt clip to manage injection of dependencies, like a database (connection), a kafka connection) etc..

dharrigan 2020-12-26T11:36:24.248100Z

it works fine as-is, with the standard jvm and an uberjar

borkdude 2020-12-26T11:36:35.248400Z

clojure.core/eval doesn't work in a graalvm binary, since it needs the Clojure compiler and dynamic classloading

dharrigan 2020-12-26T11:37:08.248900Z

Does that mean things like the component system by Stuart Sierra wouldn't work either?

dharrigan 2020-12-26T11:37:21.249200Z

(or mount etc...)

borkdude 2020-12-26T11:38:52.249500Z

@dharrigan it depends. :P

dharrigan 2020-12-26T11:38:56.249800Z

🙂

borkdude 2020-12-26T11:38:59.250100Z

@dharrigan I don't see why it wouldn't work

dharrigan 2020-12-26T11:39:04.250300Z

Just looking over the source code

borkdude 2020-12-26T11:39:15.250600Z

We are using component just to start/stop things, not to dynamically require things

dharrigan 2020-12-26T11:39:29.250900Z

right right

borkdude 2020-12-26T11:39:43.251300Z

And as I said, if you statically require those things beforehand, it should still work when you dynamically require those things

borkdude 2020-12-26T11:40:00.251800Z

It's just that clojure.core/eval doesn't work dynamically

dharrigan 2020-12-26T11:40:14.252100Z

That's interesting. Let me try that out

dharrigan 2020-12-26T11:40:15.252300Z

bbl

dharrigan 2020-12-26T12:03:31.252600Z

making some progress indeed by requiring them

dharrigan 2020-12-26T12:03:43.253Z

it's slow progress, will keep plugging away at it.

borkdude 2020-12-26T12:24:56.253400Z

some libs work better than others with graalvm (depending on what they do).

dharrigan 2020-12-26T12:25:31.254Z

I'm hopeful 🙂