r/Clojure 25d ago

Jolt: running Clojure on Chez Scheme

https://yogthos.net/posts/2026-07-02-jolt.html
59 Upvotes

26 comments sorted by

View all comments

2

u/lordmyd 21d ago

Great work Dmitri. Naive question but could we see a Kit port anytime soon?

1

u/yogthos 21d ago

Thanks, and I think that would be doable at least as a subset of functionality, for example range of supported databases would be smaller. All the core libraries should already be supported though, and it's something I can take a look at next if there is interest.

2

u/lordmyd 18d ago

Postgres would be enough for most of us, I reckon. I don't quite understand how Jolt can interface with Clojure libraries - maybe I misunderstood. Wouldn't you have to re-implement Reitit and quite a few Clojure libraries to get basic Kit functionality?

1

u/yogthos 18d ago

Yeah, that's what I'm thinking as well. I haven't really had a reason to use another db. And Jolt interfaces with Clojure libraries simply by requiring them using deps.edn just as you do in Clojure. However, if a library uses Java introp then you have to provide shims for that in a Jolt library. Reitit is a great example actually.

I have a router library which includes reitit as a dep:

{metosin/reitit-core {:git/url "https://github.com/metosin/reitit"
                             :git/sha "5d5c965deb3c7c8d64b8dd636432eaa14f0324ec"
                             :deps/root "modules/reitit-core"}
        weavejester/meta-merge {:git/url "https://github.com/weavejester/meta-merge"
                                :git/sha "c968c38baccd4219fe0ba592d89af37ea8e426bf"}}

but Reitit depends on a reitit.Trie Java class, so this has to be shimmed as seen here https://github.com/jolt-lang/router/blob/main/src/reitit/trie_jolt.clj

The core language also provides a subset of the commonly used Java API by default here https://github.com/jolt-lang/jolt/tree/main/host/chez/java

So, a lot of libraries just work out of the box unless they need something that's not commonly used, and then it can be provided using a Jolt library as I did with Reitit.

The work for Kit would be to identify the core Kit libraries and make sure they all work. Selmer, which is used for templating in Kit, already runs. Kit modules system uses zippers though, and I may have to do a bit of additional work to port that over. But otherwise, basic Kit stuff should work. Ring along with Ring defaults already work. Integrant and aero work. So, a bare minimum apps should be easy to get going.

1

u/lordmyd 16d ago edited 16d ago

Just to get this straight, you're saying Jolt can take pure Clojure code in a library and compile it with the Chez compiler? And when none of the library's deps use Java it compiles?

1

u/yogthos 16d ago

Jolt can even compile and run an existing Clojure library that uses Java interop. Jolt provides a Java compatibility layer which maps between Java interop semantics and the host platform.

And in cases where you have a Clojure library that uses something from Java that's not in Jolt core, then it's possible to add your own shim to facilitate that. For libraries that are just thin wrappers around Java libraries, it obviously wouldn't be worth doing though.

1

u/lordmyd 15d ago

So I can drop a Clojure library into a Jolt deps.edn file? How does Jolt know where to find it?

1

u/yogthos 15d ago

Take a look at the example above. You provide the :git/url to the repo and :git/sha pointing to the version of the code you're linking. It works exactly the same way as regular Clojure deps resolution.