I hope this isn't the case, since I see Rust as the C++ replacement, and another replacement isn't very interesting to me. The main reason I've been interested in Zig is because I thought it was a replacement for C, which is an interesting idea.
I hope this isn't the case, since I see Rust as the C++ replacement, and another replacement isn't very interesting to me. The main reason I've been interested in Zig is because I thought it was a replacement for C, which is an interesting idea.
I would say that Zig is:
C - {make, autoconf, etc., preprocessor, UB[0]} + {*defer, !, ?, catch/try, "async"[1], alignment, comptime}
I don't think that rises to the level of "C++ replacement". Maybe it's that comptime lets you do generics a la C++ templates?
[0] by default, in zig you can have UB for performance
[1] in quotes because async is not actually async, it's a control flow statement that is usually and most usefully used to do async things.
Even if Zig doesn't fizzle like the overwhelming majority of languages, it won't replace, or displace, C, never mind C++. Everybody willing to move on from C already did a long time ago. People still using C today like it for its failings, so a language that fixes them is exactly what they don't want. It doesn't give C++ users any of the things they need.
The only real advance in systems languages in the last 50 years is the destructor, so it is frankly weird to find a new language without it. The Drop trait is all that makes Rust a viable prospect for its own miracle.
Long story short : those who want that sort of programming language know why.
To the extent that Zig's features in these areas (and also generics) make it "not a real C replacement", that's when I question whether a real C replacement is actually what anybody wants.
For what it's worth, Zig has a very similar deferred function call mechanism for deferred cleanup, and something like Rust's Result type. See https://ziglang.org/documentation/master/#defer and https://ziglang.org/documentation/master/#Error-Union-Type .