Fork me on GitHub
#graalvm
<
2023-01-03
>
mkvlr14:01:30

TIL about guest language support in native-image: > Native Image supports JVM-based languages, e.g., Java, Scala, Clojure, Kotlin. The resulting image can, optionally, execute dynamic languages like JavaScript, Ruby, R or Python. Polyglot embeddings can also be compiled ahead-of-time. To inform native-image of a guest language used by an application, specify --language:<languageId> for each guest language (e.g., --language:js). > – from https://www.graalvm.org/22.0/reference-manual/native-image/ Has anyone here used this already?

mkvlr14:01:57

tried this out naively with clerk (https://github.com/nextjournal/clerk/tree/native-image) but https://gist.github.com/mk/f6b043ada640904abe4d3ed215fd75b5 around com.oracle.truffle.js.runtime.JSRealm.random.

borkdude14:01:30

I've played around with this, e.g. embedding JS in bb, it works. But what doesn't work well, or at least, at the time, was pre-warming a context so it would start faster

borkdude14:01:09

If you're trying to compile the CLJS compiler to native: this might work to some degree (in theory, I've never seen it work in practice), but macroexpansion has a problem since it relies on clojure.core/eval

mkvlr14:01:26

use case would just be our js markdown parser for now

mkvlr14:01:41

where we could also go down the quickjs route

borkdude15:01:25

right, so you want a binary to shell out to for markdown?

mkvlr15:01:20

was trying to compile all of Clerk to native

catjam 4
mkvlr15:01:11

would need to include sci / bb to be actually useful