116 points · by luu · 7y ago · 40 comments
Of course, language preference is personal and aesthetic, and different people have different preferences.
Rust is a more complex language, but it eliminates a number of classes of memory error. In this case, the programmer bears the cost of users having safer programs.
Although I find Zig very interesting—and I wish Andy the best of success with it—the trade-off that the Rust offers is more in line with my values and my ethics.
No, they don't. See Zig's release-safe mode.
Also: https://news.ycombinator.com/item?id=17184929
> the trade-off that the Rust offers is more in line with my values and my ethics.
By the way, it's awesome that you like Rust, but there's no need to imply there's something ethically wrong with Zig. Depending on the platform you're targeting, you may yet find a use for either language.
Zig does something different, and no, it doesn't work like C. Zig allows (and encourages) you to turn on runtime checks that also guarantee no memory errors, but at a cost to performance. Then, after testing, you can turn those off for your entire program or just the performance-sensitive parts. So this, combined with language simplicity, also gets rid of those bugs, except not with 100% guarantee. The fact that Zig is so simple also helps reduce other kinds of bugs perhaps better than Rust. Soundness comes at a cost that, perhaps unintuitively, can harm correctness.
So to make this simplistic, you could say that Rust sacrifices other kinds of bugs (due to complexity) in order to guarantee no bugs of a certain class, while Zig gives you no 100% guarantee regarding any kind of bug (after turning off runtime checks), but it does give you the tools and the focus to reduce bugs across the board.
So even if you're uncompromising on correctness to the point you employ formal methods (as I do, and I assume you do, too, as you consider it a matter of ethics), there's still no clear winner even on correctness alone between the two approaches. You could just as well argue that your ethics directs you to preferring Zig, because it may well be that its correctness story is stronger than Rust's; we just don't know. I like to choose my own "correctness focus" and I dislike complex languages so I prefer Zig, but I completely understand that Rust is a better fit for other people's tastes.
[1]: This, e.g., is what you can do with ACSL and C.
this is basically the point of having a simple language
I’m more concerned by the typeid switching, but maybe it’s got a proper structured mechanism as well.
And fully fixed in future C++20 codebases with concepts.
Does anybody know the reason?
Eventually, i'll be Zig all the way down, but the language needs to get to the point where it can actually support writing a compiler for itself (and Andrew has some big plans for the way the compiler should work from what I understand).