←back to thread

Things Zig comptime won't do

(matklad.github.io)
458 points JadedBlueEyes | 2 comments | | HN request time: 0.011s | source
Show context
no_wizard ◴[] No.43744932[source]
I like the Zig language and tooling. I do wish there was a safety mode that give the same guarantees as Rust, but it’s a huge step above C/C++. I am also extremely impressed with the Zig compiler.

Perhaps the safety is the tradeoff with the comparative ease of using the language compared to Rust, but I’d love the best of both worlds if it were possible

replies(5): >>43744960 #>>43745201 #>>43745418 #>>43745573 #>>43749228 #
xedrac ◴[] No.43745201[source]
I like Zig as a replacement for C, but not C++ due to its lack of RAII. Rust on the other hand is a great replacement for C++. I see Zig as filling a small niche where allocation failures are paramount - very constrained embedded devices, etc... Otherwise, I think you just get a lot more with Rust.
replies(2): >>43745255 #>>43745507 #
rastignack ◴[] No.43745507[source]
Compile times and painful to refactor codebase are rust’s main drawbacks for me though.

It’s totally subjective but I find the language boring to use. For side projects I like having fun thus I picked zig.

To each his own of course.

replies(1): >>43745951 #
1. nicce ◴[] No.43745951[source]
> refactor codebase are rust’s main drawbacks

Hard disagree about refactoring. Rust is one of the few languages where you can actually do refactoring rather safely without having tons of tests that just exist to catch issues if code changes.

replies(1): >>43746010 #
2. rastignack ◴[] No.43746010[source]
Lifetimes and generic tend to leak so you have to modify your code all around the place when you touch them though.