Show HN: Zero C# – C# without a runtime or GC
A bare‑metal variant of C# that strips out the .NET runtime, garbage collector, and features like reflection is prompting debate over whether C# without GC is useful or just C-like code with nicer syntax. Supporters see value for tiny binaries, demoscene work, embedded targets, or latency‑sensitive domains, often using arena allocators instead of tracing GC. Critics counter that C#’s ecosystem, standard library, and developer habits are built around managed memory, making Rust, Zig, or even conventional C++ more practical for serious non‑GC projects.
Project and Goals
- Zero C# removes the .NET runtime and GC, compiling C# to native code with arena-based allocation.
- Built atop bflat; intended for very small binaries, bare-metal or OS-less targets, and environments like DOS or UEFI.
Garbage Collection vs Manual/Arena Memory
- Many argue GC is a key C# feature: improves safety and productivity, reduces leaks and temporal bugs (use-after-free), and enables moving/compacting heaps.
- Others emphasize GC as a trade-off: unpredictable pauses and loss of precise latency control, especially problematic for real-time or low-latency domains.
- Some claim modern .NET GC is highly tunable (latency modes, manual triggering, pinning, unsafe, NativeAOT), giving “a lot of control” if understood.
- Counterpoint: tracing GC is fundamentally non-deterministic; if you truly need deterministic lifetimes, use reference counting, RAII, arenas, or non-GC languages.
Arenas and Alternative Models
- Arenas praised for simplicity and performance when lifetimes match clear phases (e.g., per-request).
- Critics note arenas are not general: hard to use for complex, long-lived or overlapping lifetimes, especially with concurrency.
- Several note that generational moving GCs already behave like sophisticated arenas without their limitations.
- View that “no GC” does not automatically mean faster; malloc/free and fragmentation still have costs.
Ecosystem and Compatibility
- Major concern: almost none of the existing C#/.NET ecosystem works. Standard library is missing or heavily cut; even basic types like rich strings are limited.
- Without GC, most existing C# code and libraries (which assume a managed heap, reflection, higher-level collections) must be rewritten.
- For real applications that need WinAPI, GUI, or DLLs, commenters find they’d need to reimplement too much.
Comparisons to Other Languages
- Many ask: why not just use C, C++, Rust, or Zig, which were designed without GC and have established memory-management patterns and ecosystems?
- Some characterize Zero C# as “C with C# syntax” or a constrained subset of C++/Rust but without their safety guarantees or library support.
Use Cases and Perceived Niche
- Suggested niche: demos, size-constrained intros, bare-metal experiments, educational or esoteric use.
- Skepticism that it’s viable for large, long-lived or production systems, though a few find the experiment interesting and conceptually appealing.