Project ideas from Hacker News discussions.

Tail-call optimization in C is relatively recent (2025)

📝 Discussion Summary (Click to expand)
  • TCO should be a language requirement, not just an optional optimization – “Well, and also because of the ‘I’ve been told in Scheme you should do it this way, so by gum I’m going to do it this way!’” — pfdietz

  • Safe TCO needs explicit drop‑order handling (e.g., Rust’s become) – “The proposed become keyword tries to core::mem::drop any such variables, if it succeeds now that tail call is last and we can do TCO, if it fails we can diagnose the problem.” — tialaramex

  • Missing TCO can alter a program’s observable semantics (e.g., stack‑overflow or changed complexity) – “If you wrote a correct binary search algorithm and you observed that, under one language implementation, the time complexity scaled linearly with the size of the input instead of logarithmically, you would think the semantics of the program were changed.” — drdexebtjl


🚀 Project Ideas

[Rust become‑keyword Compiler Plugin]

Summary

  • A Rust crate that adds a become keyword with compile‑time TCO guarantees, turning failed TCO attempts into hard errors.
  • Provides the core value proposition of forcing tail‑call optimization or failing to compile, matching the discussion’s desire for stronger diagnostics.

Details

Key Value
Target Audience Rust developers writing recursive algorithms or state‑machine code
Core Feature Detects become usage, validates TCO feasibility, and errors if impossible
Tech Stack Rust compiler (rustc), cargo, procedural macros, LLVM back‑end
Difficulty High
Monetization Revenue-ready: $20/mo per user

Notes

  • HN commenters emphasized the need for a keyword that “goes to more length to deliver TCO” – this tool fulfills that promise.
  • Enables immediate discussion by exposing exactly where the compiler cannot guarantee TCO, matching tialaramex’s desire for clearer diagnostics.

[Tail‑Call Linter for JavaScript]

Summary

  • ESLint rule that flags non‑tail‑call‑compatible recursion patterns and suggests safe refactorings.
  • Guarantees stack‑overflow safety for functional‑style JS code, addressing the pain point that “Js really should have it.”

Details

Key Value
Target Audience JavaScript developers building parsers, interpreters, or deep‑recursion logic
Core Feature Static analysis that marks tail‑call opportunities and warns when optimizing would be required
Tech Stack ESLint plugin, TypeScript, Node.js
Difficulty Medium
Monetization Revenue-ready: $10/mo per developer for CI integration

Notes

  • Directly references the Hacker News comment “Js really should have it.” from groundzeros2015.
  • Provides practical utility by preventing runtime stack overflows while sparking conversation about proper tail calls in JS.

[Clang‑tidy musttail Checker]

Summary

  • A clang‑tidy check that enforces the use of [[gnu::musttail]] only when TCO is provably possible, otherwise emits a compile‑time error.
  • Aligns with steveklabnik’s observation that “[[gnu::musttail]]” exists but lacks full diagnostics.

Details

Key Value
Target Audience C/C++ library maintainers who rely on deep recursion or state‑machine implementations
Core Feature Detects functions annotated with [[musttail]] that cannot be TCO’d and errors, plus suggests adding the attribute where safe
Tech Stack clang, libclang, Python scripting, CMake integration
Difficulty Medium
Monetization Revenue-ready: $30/mo per engineering team

Notes

  • Echoes tialaramex’s comment that “knowing if I didn’t get what I wanted is most of the value” – the checker supplies that certainty.
  • Generates discussion by exposing the precise conditions under which TCO fails, a topic of frequent HN debate.

[WasmTail TCO Runtime]

Summary

  • A WebAssembly runtime library that rewrites tail calls into iterative loops at compile time, eliminating stack‑overflow risk for functional code.
  • Meets the need expressed for “TCO is still in the spec” but missing in most WASM engines.

Details

Key Value
Target Audience WASM developers building interpreters, symbolic executors, or game engines in WebAssembly
Core Feature Compile‑time transformation of tail‑call nodes into jump‑based loops with manual stack bookkeeping
Tech Stack wasm‑bindgen, Rust, Emscripten, Webpack loader
Difficulty High
Monetization Revenue-ready: $0.01 per million tail‑call transformations

Notes

  • Cites the sentiment “TCO is still in the spec” and the practical obstacle that “the only conforming interpreter” is Safari’s JSKit, making this tool valuable.
  • Sparks community dialogue by providing a concrete way to bring proper tail calls to the broader WASM ecosystem.

Read Later