2/2/2026 at 10:46:04 PM
250 C files were deleted. 2032 to go. Watching Zig slowly eat libc from the inside is one of the more satisfying long term projects to followby OsamaJaber
2/3/2026 at 5:44:31 AM
That's something I've always admired about Zig.A lot of languages claim to be a C replacement, but Zig is the second language I've seen that seemed like it had a reasonable plan to do so at any appreciable scale. The language makes working with the C ABI pretty easy, but it also has a build system that can seamlessly integrate Zig and C together, as well as having a translate-c that actually works shockingly well in the code I've put through it.
The only thing it didn't do was be 99% compatible with existing C codebases...which was the C++ strategy, the first language I can think of with such a plan. And frankly, I think Zig keeping C's relative simplicity while avoiding some of the pitfalls of the language proper was the better play.
by LexiMax
2/3/2026 at 7:56:28 AM
D can import C files directly, and can do C-source to D-source translation.D can compile a project with a C and a D source file with:
dmd foo.d bar.c
./foo
by WalterBright
2/3/2026 at 10:21:42 AM
Do you have to bring up D in every Zig related post?I do like D. I've written a game in it and enjoyed it a lot. I would encourage others to check it out.
But it's not a C replacement. BetterC feels like an afterthought. A nice bonus. Not a primary focus. E.g. the language is designed to use exceptions for error handling, so of course there's no feature for BetterC dedicated to error handling.
Being a better C is the one and only focus of Zig. So it has features for doing error handling without exceptions.
D is not going to replace C, perhaps for the same reasons subsets of C++ didn't.
I don't know if Zig and Rust will. But there's a better chance since they actually bring a lot of stuff to the table that arguably make them better at being a C-like language than C. I am really hyped to see how embedded development will be in Zig after the new IO interface lands.
by audunw
2/3/2026 at 10:54:12 AM
He doesn't have to, he _gets_ to! Its knowledge exchange. Take it as a gift and not self-promotion. There's no money in this game so don't treat it like guerilla marketing. Treat it like excited people pushing the limits of technology.by cma256
2/3/2026 at 4:18:40 PM
I think the history of D having a garbage collector (and arguably exceptions / RTTI) from the beginning really cemented its fate. We all know that there's a "BetterC" mode that turns it off - but because the D ecosystem initially started with the GC-ed runtime, most of the D code written so far (including most of the standard library) isn't compatible with this at all.If D really wants to compete with others for a "better C replacement", I think the language might need some kind of big overhaul (a re-launch?). It's evident that there's a smaller, more beautiful language that can potentially be born from D, but in order for this language to succeed it needs to trim down all the baggage that comes from its GC-managed past. I think the best place to start is to properly remove GC / exception handling / RTTI from the languge cleanly, rewrite the standard library to work with BetterC mode, and probably also change the name to something else (needs a re-brand...)
by cyber_kinetist
2/3/2026 at 6:25:26 PM
My post was not about betterC, it was about the super easy interoperability of C and D. This capability has been in D for several years now, and has been very popular as there's no longer a need to write an adapter to use C source code. The ability to directly compile C code is part of the D compiler, and is known as ImportC.One interesting result of ImportC is that it is an enhanced implementation of C in that it can do forward references, Compile Time Function Execution, and even imports! (It can also translate C source code to D source code!)
by WalterBright
2/3/2026 at 11:58:24 AM
This is, like, the most ironic comment ever posted on HN. An article about cat nutrition could hit the front page and the Rust fanbois would hijack the conversation.In this case, however, Walter was not the one that brought up D. He was replying to a comment by someone promoting Zig with the claim that only Zig and C++ have ever had a strategy to replace C. That is objectively false. There's no way to look at what D does in that area and make that sort of claim. Walter and anyone else is right to challenge false statements.
by bachmeier
2/3/2026 at 4:35:35 PM
> claim that only Zig and C++ have ever had a strategy to replace CWhat I actually said was that it was the second language I have seen to do so at any appreciable scale. I never claimed to know all languages. There was also an implication that I think that even if a language claims to be a C replacement, its ability to do so might exceed its ambition.
That said I also hold no ill will towards Walter Bright, and in fact was hoping that someone like him would hop into the conversation to try and sell people on why their language was also worthy of consideration. I don't even mind the response to Walter's post, because they bring real-world Dlang experience to the table as a rebuttal.
On the other hand, I find it difficult to find value in your post except as a misguided and arguably bad-faith attempt to stir the pot.
by LexiMax
2/3/2026 at 3:24:45 PM
No, he never stated that "claim that only Zig and C++ have ever had a strategy to replace C", you made that up. And "Walter was not the one that brought up D" , he actually was.Did the text get changed? because it seems you claim exactly the opposite of what is in about ~5 sentences, so it also can't be credited to "misunderstanding".
But didn't find any "D evangelism" comments in his history (first page), but then again, he has 78801 karma points, so I am also not going to put energy in going through his online persona history.
by mg794613
2/3/2026 at 3:42:07 PM
C++ is more C-like than Zig and Rust, so it's more likely to become a C replacement.by GoblinSlayer
2/3/2026 at 4:19:36 PM
I do feel like allowing for in-place source upgrading was critical to C++'s early successes. However, I feel like this ultimately worked against C++, since it also wed the language to many of C's warts and footguns.by LexiMax
2/3/2026 at 6:31:24 PM
C++ cannot seem to let go of the preprocessor, which is an anchor hurting the language at every turn.BTW, in my C days, I did a lot of clever stuff with the preprocessor. I was very proud of it. One day I decided to replace the clever macros with core C code, and was quite pleased with the clean result.
With D modules, imports, static if, manifest constants, and templates the macro processor can be put on the ash heap of history. Why doesn't C++ deprecate cpp?
by WalterBright
2/3/2026 at 2:02:36 PM
This is a bad comment in so many ways.Walter's short limited comment was quite relevant.
by jibal
2/3/2026 at 4:00:26 PM
> C-source to D-source translation.I'm not so familiar with D, what is the state of this sort of feature? Is it a built-in tool, or are you talking about the ctod project I found?
In most languages, I've found that source translation features to be woefully lacking and almost always require human intervention. By contrast, it feels like Zig's `translate-c` goes the extra mile in trying to convert the source to something that Zig can work with as-is. It does this by making use of language features and compiler built-ins that are rather rare to see outside of `translate-c`.
Obviously the stacks of @as, @fooCast, and @truncate you are left with isn't idiomatic Zig, but I find it easier to start with working, yet non-idiomatic code than 90% working code that merely underwent a syntactic change.
by LexiMax
2/3/2026 at 6:40:24 PM
It's hardwired into the D compiler binary. It will even translate C macros into D code!Well, most macros. The macros that do metaprogramming are not translatable. I read that Zig's translator has the same issue, which is hardly surprising since it is not possible.
So, yes, the translation is not perfect. But the result works out of the box most of the time, and what doesn't translate is easily fixed by a human. Another issue is every C compiler has their own wacky extensions, so it is impractical to deal with all those variants. We try to hit the common extensions, though.
If you just want to call C code, you don't have to translate it. The D compiler recognizes C files and will run its very own internal C compiler (ImportC) to compile it. As a bonus, the C code can use data structures and call functions written in D! The compatibility goes both ways.
by WalterBright
2/3/2026 at 6:21:33 PM
I've always admired your work, Walter. Keep it up!by AndyKelley
2/3/2026 at 6:31:53 PM
Thank you for the kind words, Andy!by WalterBright
2/3/2026 at 10:58:27 AM
This is the smart choiceYou keep compatibility with C, can tap into its ecosystem, but you are no longer stuck with outdated tooling
D gives you faster iteration, clearer diagnostics, and a generally smoother experience, even if it doesn't go as far as Rust in terms of safety
I wish more languages would follow this strategy, ImportC is great, let's you port things one step at a time, if required/needed
Let's be honest: who wants to write or generate C bindings? And who wants to risk porting robust/tested/maintained C code incorrectly?
by WhereIsTheTruth
2/3/2026 at 6:43:29 PM
> who wants to write or generate C bindings?Not me, and not anyone else. Many D users have commented on how ImportC eliminates the tedium of interfacing to me.
And with D, you don't have to write .h interface files, either (although you can, but it turns out pretty much nobody bothers to).
by WalterBright