> All I want in life is a pure C API. It is simple and elegant and delightful and you can wrap it to run in any programming environment in existence.
Sure thing boss, here's that header file populated exclusively by preprocessor macros that you asked for.
Re:Thoughts on Go vs. Rust vs. Zig
by forrestthewoods on Friday December 05, 2025 @12:01PM
(#46164000)
Super weird reply.
Sad by many an engineer whose code was running in systems that were in fact not that simple!
What is irksome is that globals are actually just kinda straight worse. Like the code that doesn't use a singleton and simply passes a god damn pointer turns out to be the simpler and easier thing to do.
> What types of code are you working on that this occurs so frequently?
Assorted C++ projects.
It is particularly irksome when libraries have globals. No. Just no never. Libraries should always have functions for "CreateContext" and "DestroyContext". And the public API should take a context handle.
Design your library right from the start. Because you don't know what execution environments will run in. And it's a hell of a lot easier to do it right from the start than to try and undo your evilness down the road.
All I want in life is a pure C API. It is simple and elegant and delightful and you can wrap it to run in any programming environment in existence.