Live data from Hacker News

Zig feels more practical than Rust for real-world CLI tools

dayvster.com

21–30 of 412 posts

Re: Zig feels more practical than Rust for real-world CLI tools

#21
The benefit of Zig seems to be that it allows you to keep thinking like a C programmer. That may be great, but to a certain extent it’s also just a question of habit.

Seasoned Rust coders don’t spend time fighting the borrow checker - their code is already written in a way that just works. Once you’ve been using Rust for a while, you don’t have to “restructure” your code to please the borrow checker, because you’ve already thought about “oh, these two variables need to be mutated concurrently, so I’ll store them separately”.

The “object soup” is a particular approach that won’t work well in Rust, but it’s not a fundamentally easier approach than the alternatives, outside of familiarity.

Re: Zig feels more practical than Rust for real-world CLI tools

#23

"All it took was some basic understanding of memory management and a bit of discipline." The words of every C programmer who created a CVE.

"Actually memory management is easy, you just have to...."

- Every C programmer I've talked to

No its not, if it was that easy C wouldn't have this many memory related issues...

Re: Zig feels more practical than Rust for real-world CLI tools

#24

"All it took was some basic understanding of memory management and a bit of discipline." The words of every C programmer who created a CVE.

Segfaults go brrr. All jokes aside, it doesn’t actually take much discipline to write a small utility that stays memory safe. If you keep allocations simple, check your returns, and clean up properly, you can avoid most pitfalls. The real challenge shows up when the code grows, when inputs are hostile, or when the software has to run for years under every possible edge case. That’s where “just be careful” stops worki…

My assumption is a small utility becomes a big utility.

Re: Zig feels more practical than Rust for real-world CLI tools

#25
I want to like Zig, but D still exists and feels like everything I want from a C-like alternative to C++ I just wish the rest of the industry had adopted it long ago. Zig has a strange syntax, and Rust is basically eating chunks of the industry, especially in programmer tooling across various languages as is Go (it powers most cloud providers and is the 2nd top choice for AI right after Python).

Re: Zig feels more practical than Rust for real-world CLI tools

#27

"All it took was some basic understanding of memory management and a bit of discipline." The words of every C programmer who created a CVE.

The amount of seggfaults I have seen with Ghostty did not raise my spirits.

segfaults raise my belief in spirits

Re: Zig feels more practical than Rust for real-world CLI tools

#29
post #23

"All it took was some basic understanding of memory management and a bit of discipline." The words of every C programmer who created a CVE.

"Actually memory management is easy, you just have to...." - Every C programmer I've talked to No its not, if it was that easy C wouldn't have this many memory related issues...

It may be easy to do memory management, but it's not too easy to detect if you've made a fatal mistake when such mistakes won't cause apparent defects

avoiding all memory management mistakes is not easy, and the bigger the codebase becomes, the more exponential the chance for disaster gets

Re: Zig feels more practical than Rust for real-world CLI tools

#30

"All it took was some basic understanding of memory management and a bit of discipline." The words of every C programmer who created a CVE.

The amount of seggfaults I have seen with Ghostty did not raise my spirits.

I've had at least one instance of Ghostty running on both my work and personal machine continuously since I first got access to the beta last November, and I haven't seen a single segfault in that entire time. When have you seen them?
Post reply on HN