← Back to context

Comment by LexiMax

4 hours ago

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.

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