Hacker News new | ask | show | jobs
by kibwen 4 days ago
> But unless you plan on rewriting the entire Rust ecosystem, you're going to be dealing with invisible failure points in Rust code that you would not be dealing with when writing the equivalent Zig code.

That's what Rust's libcore is for. And the converse is that if your software is written for a system with overcommit--so every typical OS and distro these days--any error path having to do with memory allocation failure is impossible to trigger, because the OS won't honestly tell you if allocation would fail.

> And Zig does have language-level features that combine to require you to explicitly handle propagated errors

Of course, and Zig also doesn't stop you from writing a data structure that papers over allocation failures by using `std.process.exit` in the error path. Zig also discourages third-party dependencies more than Rust does, so I wouldn't be surprised if people are already wisely doing this when writing their code for programs targeting systems with overcommit.