Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> There is no corresponding popular replacement for C that's more minimalist than Rust and memory safe.

In the real world, memory safety is not all-or-nothing (unless you're willing to concede that Rust is not safe either, since unsafe Rust exists). I'm working on an embedded project in Rust and I'd MUCH rather be using Zig. The only safety thing that Rust would give me that Zig does not is protection from returning pointers to stack-allocated objects (there are no dynamic allocations and no concurrency outside of extremely simple ISRs that push events onto a statically allocated queue). But in exchange I have to deal with the presence of unsafe Rust, which feels like a gigantic minefield even compared to C.



protection from returning stack pointers seems to be detectable with static analysis of zig AIR.

https://github.com/ityonemo/clr


> But in exchange I have to deal with the presence of unsafe Rust, which feels like a gigantic minefield even compared to C.

I think idiomatic coding norms for unsafe Rust are still a bit half-baked, and this is where something like Zig can have an advantage of sorts. You can see this also, e.g. in the ongoing proposals for a Pin<> alternative.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: