hn.today

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

onurgumus.github.io163 points113 comments
Screenshot of Show HN: Zero C#, Power of C# without any GC

Zero C# is a fork of bflat that compiles C# directly into small native programs without the .NET runtime or a garbage collector. Its central idea is to keep much of modern C# - including generics, interfaces, records, lambdas, queries, and threading - while making memory management explicit. Programs allocate from arenas and release memory in bulk; temporary input and formatted output can use stack buffers or direct output routines, while longer-lived strings and collections belong in arenas. The tradeoff is a different runtime model: exceptions end the program, errors are returned as unions, and reflection and async are unavailable.

The same sample is built for Linux, macOS, Windows, WebAssembly, and 386-based DOS, with a shared test suite checking that it produces consistent output. Reported hello-world sizes range from about 11 KB on Windows to 40 KB on Linux; the examples also show builds of roughly 65 KB for macOS and 16 KB for WebAssembly. The DOS program runs through an extender in an emulator. A small library provides strings, collections, input, and output, alongside tutorials and guides to arena allocation and memory safety. The project is aimed at developers who want small, portable executables without installing a runtime and are willing to manage memory and work without some .NET features. It is MIT-licensed, while the bflat fork is AGPL-3.0.

Read on onurgumus.github.io113 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

Big Data Is Dead

Big Data Is Dead

Big data is not the main obstacle to useful insights: hardware has kept pace with data growth, while teams still struggle to make sense of their information. The author argues that organizations should focus on making data easier to understand and use, rather than buying tools built for ever-larger datasets. (motherduck.com)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.