4 ms·
I don't think you can say that Zig is as correct as Rust given that memory-safety is not guaranteed by Zig (as evidenced by the article we're commenting on).
by Ar-Curunir 6y ago
I don't think you can say that Zig is as correct as Rust given that memory-safety is not guaranteed by Zig (as evidenced by the article we're commenting on).
- pron 6y agoWhether a language is "correct" is meaningless (hopefully, most compilers/interpreters are reasonably correct); we're talking about which language makes it easier to write correct programs, and because both languages focus heavily on that goal yet take very different approaches to achieving it (the article only compares one), it is simply impossible to tell at this point which of those languages, if any, achieves that goal better than the other.
- pjmlp 6y agoExcept you are assuming that Zig will never change after 1.0 release. C17 is also quite different from K&R C, specially in what optimizers do with UB. The only way OS vendors have to fix issues that Zig also shares with C, C++ and Objective-C, as per the article, is to adopt hardware memory tagging, something already available on Solaris SPARC, Azure Sphere and iOS (yes PAC is a bit different), with ongoing work for ARM. So I really don't see the benefit, but lets see how Zig 1.0 actually looks like, and I might be wrong by then.
- pron 6y agoI'm talking about Zig as it is now. If the design drastically changes, it would be different story. The UB comparison is not very relevant though because Zig, a language that takes correctness seriously, aims to make it very easy to not have any UB (at least with high probability) in its safe mode. Aside from being inherently safer than C, and arguably C++, even with all of those enhancements (not considering safe variants of C), Zig brings benefits other than safety. Like terrific cross compilation, fast builds, and a language that is extremely expressive yet very simple and easy to learn. But I've long ago learned that language preference is mostly a matter of personal aesthetics, so all I can say is that I find Zig very appealing. Its design is certainly radical, and it doesn't feel like any other low-level language I've ever seen (it is about equidistant from C, C++, Rust, D, Nim, Ada; even when pushed I don't think I'd be able to say which of those Zig is most like, because it is so different). Like it or not, it offers a fresh vision on how low-level programming can be done.
- pjmlp 6y agoBy the way, Apple decided to just use "Safe C" for their iBoot firmware, but other than documentation references on Apple Developer, they are probably not going to share it with the world.