Technology1 min read

Show HN: Zero C#, Power of C# without any GC

By · Published by Everything Blog

In short

The toolchain compiles directly into native binaries as small as 11 KB on Windows and 40 KB on Linux without requiring a pre-installed framework. While developers retain access to features like records, generics, and multi-threading, standard mechanisms like reflection and exception catching are entirely removed. To handle errors and data safely, the environment substitutes traditional exceptions with unions and utilizes stack buffers for text processing. A unified test suite confirms that identical source code can compile cleanly across five separate target platforms.

Key points

  • Modern language capabilities like records, tuples, real generics, and multi-threading rem…: Modern language capabilities like records, tuples, real generics, and multi-threading remain fully functional without the standard runtime.
  • Developers handle error states and data parsing through lightweight alternatives like uni…: Developers handle error states and data parsing through lightweight alternatives like union return types and direct stack buffers.
  • The compiler targets diverse operating systems from Apple Silicon macOS and WebAssembly t…: The compiler targets diverse operating systems from Apple Silicon macOS and WebAssembly to legacy DOS on 386 processors.

Sources checked by our analysis pipeline: 1

C# with nothing underneath

A fork of bflat compiles C# straight to a small native program: no .NET runtime, no garbage collector, nothing to install where it runs.

You keep C#'s syntax, type checking and generics. Memory comes from arenas you free all at once, and a small library gives you strings, collections, input and output on those terms. The same source runs on Linux, macOS and Windows, on WebAssembly, and on DOS on a 386.

// Read into a stack buffer: nothing allocated per answer.

Span<char> buffer = stackalloc char[32];

Out.Write($"Q{i}: {a} + {b} = ");

int length = In.ReadLine(buffer);

// Kept until the end, so it goes into an arena.

mistakes.Add(Str.Format(keep,

$"{a} + {b} = {a + b}, not {value}"));

The language stays, the runtime goes

The compiler still checks everything it checks in .NET. What's missing is what a runtime would do while your program runs.

You keep

- C# 15Unions, extension members and the new memory safety rules.

- Real genericsA specialized copy for each type, and static abstract members.

- Interfaces and virtual methodsDefault interface…

Technology