graalvm

mkvlr 2023-01-03T14:06:30.801269Z

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?

mkvlr 2023-01-03T14:35:57.137579Z

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.

borkdude 2023-01-03T14:48:30.781069Z

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

borkdude 2023-01-03T14:49:09.555799Z

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

mkvlr 2023-01-03T14:54:26.974419Z

use case would just be our js markdown parser for now

mkvlr 2023-01-03T14:54:41.230369Z

where we could also go down the quickjs route

borkdude 2023-01-03T15:19:25.413859Z

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

mkvlr 2023-01-03T15:30:20.020839Z

was trying to compile all of Clerk to native

2
mkvlr 2023-01-03T15:31:11.789719Z

would need to include sci / bb to be actually useful