News for hackers. Stuff that matters.
Re:Why I rewrote my Rust keyboard firmware in Zig: consisten... by atombender on Sunday March 07, 2021 @05:36PM (#26380468)
I like Zig a lot, but I'm concerned that it's yet another language that leaves memory management up to the developer.

For example, Zig does not appear to have any concept of lifetimes, and does not enforce single mutable ownership. As I understand it, Zig does not have RAII, either, so cleanup (with "defer", etc.) is also left as an exercise for the programmer. Zig has arenas, allowing quick cleanup, but seems pretty bare-bones otherwise.

(I was relieved to see that Zig does not allow unchecked null pointers.)

Re:Why I rewrote my Rust keyboard firmware in Zig: consisten... by higerordermap on Sunday March 07, 2021 @08:23PM (#26381446)
In very low level programming, we probably want more fine grained control, and specialized code tends to use specialized arena allocators anyway.

If I am to write a browser engine, I'd choose rust, to write an embedded OS I'd choose zig.

Re:Why I rewrote my Rust keyboard firmware in Zig: consisten... by j-krieger on Monday March 08, 2021 @03:25AM (#26383378)
Rust has fine-tunable control. It‘s just locked behind an „unsafe“ block.