jank - Clojure to Native Compiler

用C++编写的Clojure方言,编译到原生二进制

⭐⭐⭐⭐⭐ (5星)

探索来源

来源: Lobsters社区

原文链接: jank is off to a great start in 2026

核心亮点

  • 两阶段构建: 先编译为C++,再编译为原生二进制文件
  • 出色的C++互操作: 可以直接调用C++标准库和任意C++代码
  • nREPL服务器: 用jank自身编写,支持NeoVim/Conjure和Emacs/CIDER
  • 类型DSL: 自定义语法描述复杂C++类型(模板、指针、引用等)
  • 垃圾回收稳定性: 6周时间解决GC问题
  • LLVM 22兼容: 解决上游API变更带来的性能回归(启动时间从1分钟降至1秒)
  • 社区支持: Clojurists Together赞助,Github sponsors支持

技术细节

"The new nREPL is crazy fun to play around with. Works seamlessly with my editor (NeoVim + Conjure). It's hard to describe the experience of compiling C++ code interactively - I'm so used to long edit-compile-run loops and debuggers that it feels disorienting (in a good way!)"

— Matthew Perry, early jank nREPL adopter

jank允许在ns宏中直接include C++头文件,并使用:refer-global引用全局符号:

(ns foo
  (:include "gl/gl.h")
  (:refer-global :only [glClear GL_COLOR_BUFFER_BIT]))

(defn clear! []
  (glClear GL_COLOR_BUFFER_BIT))

分类标签

编程语言 编译器 Clojure Rust C++ LLVM

下一步计划

作者计划在Q2专注于性能优化,建立持续基准测试,目标是让jank在性能上接近原生C++。

相关资源