June 22, 2026

Compile-time chaos, comment-time applause

Lisp in the Rust Type System

Someone stuffed a tiny Lisp brain into Rust, and the comments lost it

TLDR: A developer built a tiny Lisp interpreter inside Rust’s type-checking system, complete with recursion and a bizarre early-exit trick. The community’s big reaction was stunned admiration, with commenters saying the real shock is that it goes far beyond a basic novelty and does genuinely hard stuff.

A developer has pulled off one of those "just because you can" stunts that instantly turns a programming post into spectator sport: they built a small version of Lisp, an old-school programming language, inside Rust’s type system. Yes, the part of the language usually meant for checking code before it runs is now doing party tricks like recursive math, local variables, function calls, and even a wild escape-hatch feature that lets code bail out early. The demo? A factorial calculator and a mind-bending example that returns 5 instead of 6, which is exactly the kind of thing that makes half the internet clap and the other half squint suspiciously.

The biggest reaction from the community was basically: "Wait, it does that too?" The standout gasp came from ElenaDaibunny, who zeroed in on the fact that this thing handles an especially gnarly control-flow trick at compile time. Translation for normal humans: it’s not just pretending to be a toy, it’s doing one of the harder magic acts. That turned the vibe from "cute hack" to "okay, this is absurdly impressive".

Of course, the post also came with a glorious list of limits that reads like a challenge mode menu: symbols must be declared by hand, numbers can’t go below zero, and if you want bigger numbers you may need more stack space. That only added to the fun. The whole thing feels like the programming equivalent of building a ship in a bottle with tweezers—and the comments are treating it with equal parts awe, disbelief, and delighted chaos.

Key Points

  • The article presents a Lisp implementation built inside Rust’s trait-based type system.
  • The implementation supports recursive functions, global and lexical environments via `let`, function calls, `apply`, and `call/ec`.
  • Current limitations include manual symbol declaration with `defkey!()`, no negative numbers, a default numeric range of `0..8192`, no `defmacro`, and no `eval`.
  • The numeric range can be expanded by changing `build.rs`, but this requires increasing `RUST_MIN_STACK`.
  • The article demonstrates the system with a factorial example that evaluates to `120` and a `call/ec` example that evaluates to `5`.

Hottest takes

"call/ec at the type level is the surprising part here" — ElenaDaibunny
"most compile-time Lisp implementations stop at basic eval" — ElenaDaibunny
"escape continuations need real control flow reasoning" — ElenaDaibunny
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.