TECHNOLOGY
Jank, a Clojure dialect built on C++, promises direct use of C++ libraries
The jank project describes itself as a Clojure dialect that runs on top of C++ and lets programmers use C++ code directly. Its website highlights a Clang-based JIT compiler, Leiningen-based tooling and game development as a use case.
Image: Jank
jank is a programming language that calls itself a dialect of Clojure built on top of C++. Its website says it offers C++ interop, meaning Clojure code can use C++ code directly, in a way the project says no other language does.
According to the site, features such as templates, virtual functions, exceptions, overload resolution and RAII "just work" in jank. RAII is a C++ habit of tying a resource, like an open file, to the life of an object so it gets cleaned up automatically. The site says you do not need boilerplate. You include your headers and start writing code.
The project describes jank as a full Clojure dialect, but with C++ interop in place of the Java interop that regular Clojure has. It also mentions a :jank reader conditional, which lets a programmer write code that only applies to jank when needed. Existing Clojure code can be kept, the site says.
On the C++ side, the site says jank can include any C++ source and link to any C or C++ library. It uses the C++ type system, and it can even compile to C++.
For development, jank offers an interactive REPL, a live prompt where you run code and see results straight away. The site says this is powered by a Clang-based C++ JIT compiler. A JIT compiler turns code into machine code while the program runs. Another part of the page describes the JIT runtime as LLVM-based. The site also says you can use your favorite nREPL editor plugin.
For project setup, jank uses Leiningen-based project management, which is a build tool from the Clojure world. It also has a native build system that the site calls Cargo-inspired, a reference to Rust's package tool. The site says this system can find native dependencies already installed on your machine or build them from source. Adding a new dependency is described as a one-line change.
The site gives a sample project file that pulls in packages for ImGui, GLFW and OpenGL. It also shows a short example that opens a 400 by 300 window with the text "Hello, jank and imgui!" The example calls C++ functions directly from Clojure-style code. Another example reads a file size with the Boost library and returns an error message if permission is denied.
The site pitches jank for game development. It says programmers get functional, immutable data and REPL-driven development, and can reach into C++ when they need extra performance. It lists "no bridges, no function/type registration, no marshalling, no callbacks" as benefits.
Finally, the site mentions ahead-of-time (AOT) compilation, which builds a finished program before it runs. It says you can tinker freely and then produce a compact binary, and that startup is instantaneous. These are the project's own claims.