yamlscript

Ingy döt Net 2023-08-22T16:03:43.125189Z

I've minimally ported YAMLScript to Clojure enough to try to take it to the next step of using GraalVM to compile it (combined with SCI) into a libyamlscript.so shared library, that in turn will be bound as module to python and shipped to PyPI as yamlscript.py (a yaml loader to load dynamic (scripted with ys clojure)). The ported code is here: https://github.com/yaml/yamlscript/tree/clojure/clojure I'm looking for advice on using graalvm and also bundling sci...

borkdude 2023-08-22T16:05:17.673759Z

> I'm looking for advice on using graalvm and also bundling sci. For a general impression of GraalVM + Clojure you can look here: https://github.com/clj-easy/graal-docs For using SCI + GraalVM: This is a simple example: https://github.com/borkdude/jayfu

borkdude 2023-08-22T16:05:43.147619Z

but you can also look at https://github.com/borkdude/jet which is a pretty simple project that uses SCI + GraalVM

borkdude 2023-08-22T16:06:08.391659Z

There's #sci and #graalvm channels too

Ingy döt Net 2023-08-22T16:06:27.908539Z

Thanks @borkdude!

Ingy döt Net 2023-08-22T16:06:52.423979Z

(I'm in those channels too)

Ingy döt Net 2023-08-22T17:10:51.580879Z

Is there a preferred FFI library for clojure. I want to swap out the snakeyaml usage for libfyaml. The result would need to work with graalvm.

hifumi123 2023-08-22T20:19:47.567919Z

I have used SWIG before, and it is annoying to use except for C/C++ libraries with a small API

hifumi123 2023-08-22T20:20:03.569359Z

In general, you are stuck with JNI until Java 21 releases, which in case you can use #coffi

hifumi123 2023-08-22T20:20:55.745809Z

note that the moment you use native libraries in clojure it becomes annoying to even just make an uberjar, since you would have to bundle a shared library for every [os architecture] tuple you intend to support

hifumi123 2023-08-22T20:22:06.770839Z

e.g. using sqlite jdbc driver in clojure already bloats a jar by some 20 MB because of all the ways [windows mac linux freebsd solaris] and [x86 amd64 arm32 arm64 ppc ppc64 s390x mips ...] can mix together. you can cleverly exclude some of these libraries from your uberjar (but know it comes at the cost of dropping support for some platform out there)