Comment by senko
1 month ago
The fact that Zig doesn't have Rust's guarantees doesn't mean Zig does not have safety checks. The safety checks that Zig does have are different, and are different in a way that's uniquely useful for this particular project.
Zig's check absolutely don't go to the extent that Rust's do, which is kind of the point here. If you do need to go beyond safe code in Rust, Zig is safer than unsafe code in Rust.
Saying Zig lacks safety checks is unfortunate, although I wouldn't presume you meant it literally and just wanted to highlight the difference.
Thing is, those safety checks are also available in C and C++, provided that one uses the right tools like PVS and PurifyPlus (just to quote two examples), and now ongoing AI based tooling efforts for verification, thus the question is why a language like Zig in the 21st century, other than "I don't like either C++ or Rust".
I never said Zig has no safety features. What I said is true, though. If it would have Rusts guarantees (as in: The same) it would be more complex.
I mean if we're going to nitpick:
>>> its lack of safety checks
>> Saying Zig lacks safety checks is unfortunate,
> I never said Zig has no safety features.
You did. Or, alternatively, if you don't equate "checks" with "features", then I never said you said that so what are you complaining about?
> If it would have Rusts guarantees (as in: The same) it would be more complex.
Which is true (if tautological), and is basically what the GP said:
> Zig's manual memory management might actually be more ergonomic for a DOM implementation specifically because you can model the graph relationships more directly without fighting the compiler, provided you have a robust strategy for the arena allocation
Both you and the GP agree that Rust is more complex.
You objected to this with:
> It's unfortunate that "writing safe code" is constantly being phrased in this way.
Upon which I commented that Zig does have safety features, even if they're not covering you as well as Rust's ones. Which is, again, inline with "provided you have a robust strategy for the arena allocation."
Now, if you think I'm going overboard with this, I agree with you -- and this is the exact feeling I have when I look at Rust :)