Zen-C: Write like a high-level language, run like C
Rust-/Swift-like syntax and design goals
- Many note the syntax looks very close to Rust (and to some, Swift), but without Rust’s borrow checker.
- One view: Zen-C is “Rust for people who don’t want Rust,” subtracting the borrow checker to keep the compiler simpler while preserving manual memory management.
- Others argue Rust already has an “ignore the borrow checker” style (clone/Arc everywhere), and question what Zen-C adds over C or Rust.
Comparison to Nim, Zig, Vala, Crystal, etc.
- Multiple comparisons to Nim: both aim at “high-level language that compiles to C,” but Nim is seen as a full, batteries-included language with GC/ARC, Unicode, bounds-checking, big stdlib, and multiple backends.
- Zen-C is characterized as “C with superpowers”: C pointers, no safety, single readable C output, minimal stdlib.
- Similar projects mentioned: Vala (actively used in GNOME), Crystal (LLVM, C interop), Jai, Odin, Chicken Scheme, Beef.
- Some feel Zen-C overlaps heavily with Zig/Rust’s space but without their strong value propositions.
C as a compilation target
- C is seen as a convenient, portable backend that lets Zen-C reuse mature compilers and tooling, and interoperate directly with C libraries.
- Some ask why not compile to Rust, assembly, or just write Rust; others note assembly backends are much more work.
- Generated C is described as “readable” but large and not realistically meant for manual editing.
Language features and ergonomics
- Features praised/criticized: RAII-like “autofree”/drop traits, traits system, tagged unions, bitfields, closures,
repeat Nloop syntax, string interpolation (with quirks), async/await, comptime code generation. - “Comptime” is essentially stringly macros that emit source text, seen as much weaker than Zig’s type-aware comptime.
- Some like
repeat 3 { ... }as a direct “max retries” construct; others highlight resemblance to Ruby/Go loop idioms.
Async/await and defer correctness concerns
- Async/await currently maps directly to threads; some find this acceptable as an abstraction boundary, others think it misses the usual event-loop motivation.
- Analysis of generated C shows
deferdoes not run on earlyreturn/break/continue/goto, which would leak resources; this is treated as a serious correctness bug.
Mutability defaults and readability
- Variables are mutable by default, but there’s a file-wide directive to flip to “immutable by default” with
mutannotations. - Several commenters find this global switch confusing for code reading and argue for a fixed choice plus a keyword (
let/var) rather than a mode. - There is an extended debate over terminology like “immutable variable,” but general agreement that the current design is easy to misread.
Safety, performance, and adoption
- Questions about memory safety and performance remain largely unanswered; Zen-C is generally assumed to be unsafe like C.
- Some see it as an impressive, inspiring early-stage project; others dismiss it as “yet another better C” without clear practical benefits.
- Rapid GitHub star growth is noted; some attribute it to HN/Twitter hype, others speculate about artificial boosting, while a few point out that many good projects get little attention.