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/.
2021-06-21T13:38:37.195800Z

@borkdude: I was wondering if you’ve seen this:

ericdallo 2021-06-22T14:20:56.236700Z

We use that way on clojure-lsp (and cljfmt I think) seems a good way indeed

borkdude 2021-06-21T13:39:12.196800Z

I have seen that

2021-06-21T13:39:20.197Z

Which looks to me like you can essentially generate the graal reflect configs etc and bundle them in library jars

borkdude 2021-06-21T13:39:28.197200Z

yes, true

2021-06-21T13:39:39.197400Z

This seems a fundamentally better way to do things

2021-06-21T13:40:12.197600Z

e.g. httpkit could just bundle that, rather than listing config for users to use in their README

2021-06-21T13:41:08.198300Z

hehe ok always one (thousand) step(s) ahead 🙂

borkdude 2021-06-21T13:41:26.198500Z

If you feel like doing a PR :)

2021-06-21T13:45:37.198700Z

lol 😆 if I had a dependency on http-kit right now I might just

2021-06-21T14:09:42.204300Z

@borkdude: So I’m thinking it would be nice for clojure graal library templates to bundle this sort of thing by default. If every lib created by something like this: https://github.com/seancorfield/clj-new/blob/develop/src/clj/new/lib.clj Included the META-INF/native-image/ as generated config that stated something like --initialize-at-build-time={{package-namespace}}, then most clojure libraries (at least ones without interop) would work in graal apps out of the box with less burden on the app creator

borkdude 2021-06-21T14:10:43.204800Z

yeah. on the other hand, it's brittle to assume that people are going to do this. I think I'll just add that little snippet to bb.edn here: https://github.com/borkdude/jayfu

borkdude 2021-06-21T14:11:50.205200Z

also it's going to be tedious if every clojure maintainer should have to do this, for every new namespace. like documentation it's always going to be out of sync

borkdude 2021-06-21T14:12:30.205600Z

instead I'll probably make a template out of jayfu if I'm satisfied enough with it

2021-06-21T14:14:16.205800Z

yeah I agree we also need tooling… But is it really for every new namespace? Most libs are bundled with all their namespaces inside a common parent, so wouldn’t it be sufficient for most libs to just mention generate that at template instantiation time?

2021-06-21T14:15:15.206Z

jayfu is new to me… If I’d known about this a month ago 😆

borkdude 2021-06-21T14:15:54.206200Z

yeah, that's true, but still. only a small portion of Clojurians are using graalvm native-image so for many people this will just be something confusing maybe

borkdude 2021-06-21T14:16:02.206400Z

there is a talk coming by ClojureD

borkdude 2021-06-21T14:16:09.206600Z

soon online, I mean

borkdude 2021-06-21T14:18:15.206800Z

I suspect DynamicClassLoader can be substituted to "do nothing" https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/DynamicClassLoader.java Perhaps that results in something useful

borkdude 2021-06-21T14:18:28.207200Z

so we're able to do everything "at runtime"

2021-06-21T14:20:20.207400Z

:thinking_face: Yeah just changing to use SecureClassLoader or URLClassLoader might be sufficient

borkdude 2021-06-21T14:21:54.207600Z

ah well, this is a research project for another time