Zero C#: C# without a runtime or garbage collector
A fork of bflat compiles C# straight to a small native program: no .NET runtime, no garbage collector[1], and nothing to install where it runs. The project keeps C# syntax, type checking and generics. Memory comes from arenas[2] that are freed all at once, and a small library provides strings, collections, input and output.
The same source builds for Linux, macOS, Windows, WebAssembly and DOS on a 386. The hello-world sample is 11 KB on Windows and 40 KB on Linux. Each build is checked by the same test suite, which requires the same output on every target.
Some common features are missing. Memory must be freed through arenas instead of a garbage collector. Exceptions are not caught: throw ends the program, so errors are returned as unions. Reflection and async are not included.
Read the original onurgumus.github.ioDiscussion
Discussion
Commenters are mostly skeptical. Several point out that NativeAOT already produces standalone C# binaries, and others say the ecosystem and libraries assume a garbage collector. Some defend the GC, citing a months-long industrial camera monitoring system, and Beef is named as a closer alternative.
Links from the post and discussion
- Beef, native C#-like language, named in comments beeflang.org
Sources
-
Zero C#
Show HN: Zero C# – C# without a runtime or GC
-
KRGeekNews KO
Zero C# - 런타임이나 GC 없는 C#


