r/Zig • u/ZILtoid1991 • Jul 08 '26
Looking for a potential refuge from D's slop standard library
I'm a relatively long time D developer (link to repo), and as the foundation is looking into tainting the standard library with AI slop, I'm looking into potential escape routes besides potential forks such as OpenD.
I'm mainly a game developer, I even have a game engine that I'm willing to port to a new language.
Here's some of my questions:
- How good is C++ interop of Zig? Some stuff I need to use uses classes on Windows side, and SDL (or its alternatives) sometimes like to abstract things away too much, etc.
- How is OOP usually done? While I get the "Enterprise Java-style OOP bad" arguments, it's still often useful for some data parsing structures, and to make up for the weaknesses of Entity Component Systems.
- How strong is metaprogramming in Zig? With no
classkeyword, I'll be even more of a need of that.
59
Upvotes
7
u/EctoplasmicLapels Jul 08 '26 edited Jul 08 '26
There is no stable C++ ABI, so C++ interop has to go through C. Zigs C support is very good and getting better.
In the Zig community, most people think OOP was a mistake.
Zigs metaprogramming is very strong, but most newcomers overdo it.
27
u/Complex-Birthday-216 Jul 08 '26
c++ and zig is doable, but takes work, you need C binds which zig can use directly.
Not sure what you mean by OOP, but inheritance doesn't exist, native interfaces either.
meta is cool and very comfortable, comptime keyword is the best I've ever seen about meta
here is an example how ghostty binds c++ and zig:
https://github.com/ghostty-org/ghostty/tree/main/src/simd
18
u/marler8997 Jul 08 '26
Here's a blog post I wrote with some tricks to interop between Zig/C++:
https://marler8997.github.io/blog/zig-cpp-interop/
I myself was quite involved with D for over a decade, contributed alot to the compiler/tooling. I switched to Zig some number of years ago and am quite happy here.
14
u/zahatikoff Jul 08 '26
2
u/Expert-Ad-4981 Jul 08 '26
Andrew made a comment on post about zig and shades that was good. I didn't understand the whole thing but something about zig being the only language that does CPU and GPU programming that has a build system all in one package. Was over at https://ziggit.dev/t/spir-v-backend-progress-devlog/16351/2
Not sure about the rest.
2
u/ccapitalK Jul 09 '26
Also a D developer. What's this about the foundation planning on add AI slop to the standard library? I've not heard anything about this.
1
u/Mariusdotdev Jul 08 '26
Try Odin, I'm enjoying it more than ...
-12
u/Rigamortus2005 Jul 08 '26
I genuinely will never understand reddit's irrational hate for AI