Jolt allows developers to run Clojure code on a Scheme host, bypassing the Java Virtual Machine (JVM) entirely to achieve standalone, self-contained executables. By translating Clojure into a host-neutral intermediate representation (IR) and then into Scheme, the project provides a path for Clojure's persistent data structures and concurrency models to run in environments where a JVM is impractical or unavailable.

Architecture and Compilation

Jolt functions as a self-hosted compiler written in Clojure. It analyzes Clojure source code and emits Scheme, which can then be executed on the Chez Scheme compiler or compiled to JavaScript via Gambit.

A code listing showing a basic Clojure program for the Jolt compiler.
A sample Clojure program demonstrating the syntax supported by the Jolt compiler.jolt-lang.net

This screenshot provides a concrete example of the Clojure source code that Jolt can compile into a Scheme-based executable.

This architecture ensures that the REPL and the final compiled binaries behave identically, as Chez Scheme handles both interpreted and compiled code with the same semantics.

“jolt build ahead-of-time compiles a project (runtime, standard library, app, and its deps) into a single self-contained executable, with C dependencies linked statically.”

— Jolt: Clojure on Scheme

Native Interop and Portability

Unlike standard Clojure, which relies on the JVM for library access, Jolt utilizes a native C FFI. This allows developers to declare and wrap C functions using `defcfn` to call shared libraries directly.

A code listing demonstrating how to bind a C library using the defcfn macro.
Example of using the defcfn macro to declare and wrap C functions for native interop.jolt-lang.net

This visual illustrates the specific mechanism for native C FFI bindings described in the Native Interop section.

This approach facilitates the creation of standalone binaries. The `jolt build` command bundles the runtime, standard library, and application dependencies into a single executable, removing the need for external dependencies like Chez or a JVM at runtime.

Clojure Compatibility and Divergences

Jolt targets Clojure semantics, meaning most portable Clojure code—including persistent collections, the numeric tower, and protocols—runs unchanged. It also supports `core.async` for channels and `go` blocks.

However, the absence of the JVM introduces specific limitations. There is no general Java interop or reflection, and the numeric tower is restricted; for example, `decimal?` is always false because `java.math.BigDecimal` is unavailable.

A table comparing the features and differences between Jolt and standard Clojure.
A comparison table highlighting the functional differences between Jolt and JVM-based Clojure.jolt-lang.net

This table summarizes the specific limitations and divergences mentioned in the final section of the article.

What Hacker News readers are saying

  • Alternative: One commenter clarified that Jolt is intended to be a superset of JVM Clojure with native features like tail-call optimization and fibers, rather than a direct drop-in replacement. comment ↗
  • Skeptical: One reader expressed concern regarding the project's maintainability, noting that the documentation appeared to be AI-generated and the build files were difficult to read. comment ↗
  • Skeptical: Another commenter questioned the author's claim that it is impossible for a single person to understand a large codebase, suggesting that many major software projects have been managed this way. comment ↗

Summarized opinions from the Hacker News thread, not verified facts. Read the full discussion ↗