Returning to Zig
84 points by liberty
84 points by liberty
That's not to say that they have given up on safety. Zig is safer than unsafe Rust. So when you find yourself in a situation where you'd have to write unsafe Rust anyway, Zig may be a better option.
This is a pretty common sort of an opinion, and it never fails to baffle me. In this case especially, where author admits that "safety is a spectrum", but then turns around and recommends essentially trading localized pockets of unsafe, for a language where everything is constantly unsafe, even if the abstract machine is marginally easier to reason about.
Zig is less safe than Rust, but it's easier to reason about and it has built-in protections against most of the footguns you'd run into with C. Additionally, Zig's strategy involves release modes rather than unsafe blocks of code, which was addressed in the article.
Being shackled to LLVM it will be a long time, if ever, until it supports as many platforms as C.
What platforms do you want to develop for that LLVM does not support? How is Zig better on this point? Is this about Zig being able to generate tier-4 C code that then GCC compiles for hppa, alpha, and sh?
As far as I understood it, it was mostly that since Zig is actively working at deprecating LLVM, implementing new targets in the Zig compiler in the future might not involve touching the LLVM project itself
LLVM code generation is not deprecated. Its just that the compiler will only produce LLVM IR, and the LLVM frontend that consumes it will be a separate package.
Generating C code is their implementation of this currently. The fact that Zig has other official backends while Rust uses LLVM is the problem here. A system language that wants to maximize software reusability should run as widely as possible, especially if it intends on replacing C like Zig does.
I only vaguely recall this, but I thought the concern was more towards compilation times than platform support.
I should give Zig another try someday. I do really want to, but so far other things have kept me busy.
The last time I tried Zig I ran into a compiler error within ~3 hours of playing around with it, which left a bit of an impression on me. (In all fairness, the bug had already been fixed at head.)