Fork me on GitHub
#graalvm
<
2020-12-26
>
dharrigan11:12:58

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

dharrigan11:12:10

Is it known to work?

borkdude11:12:32

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

dharrigan11:12:08

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

dharrigan11:12:22

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

borkdude11:12:24

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

dharrigan11:12:30

(using rc1 of clojure)

dharrigan11:12:54

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

borkdude11:12:20

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

borkdude11:12:37

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

dharrigan11:12:04

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

dharrigan11:12:24

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

borkdude11:12:35

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

dharrigan11:12:08

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

dharrigan11:12:21

(or mount etc...)

borkdude11:12:59

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

dharrigan11:12:04

Just looking over the source code

borkdude11:12:15

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

borkdude11:12:43

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

borkdude11:12:00

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

dharrigan11:12:14

That's interesting. Let me try that out

dharrigan12:12:31

making some progress indeed by requiring them

dharrigan12:12:43

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

borkdude12:12:56

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

dharrigan12:12:31

I'm hopeful 🙂