3 ms·
Can anyone with more experience elaborate on the pros and cons of Zig Vs Rust for systems programming? For example are there any efforts to write an OS in Zig?
by anonymousDan 6y ago
Can anyone with more experience elaborate on the pros and cons of Zig Vs Rust for systems programming? For example are there any efforts to write an OS in Zig?
- jamii 6y agohttps://scattered-thoughts.net/writing/assorted-thoughts-on-zig-and-rust/ https://scattered-thoughts.net/writing/assorted-thoughts-on-...
- hitekker 6y agoI like the way you structured your blog post. Quite minimal and easy to skim. My only suggestion might be to give each section a small title.
- gameswithgo 6y agoZig doesn't prevent memory errors, or data races at compile time, but Zig does handle undefined behavior better than C/C++, and has options instead of nulls. So you get some sized step in the right direction on correctness, without adding the complexity of a borrow checker. Zig compiles faster, Rust is more mature of an ecosystem. Zig is a simpler language, Rust is featureful/more complex.
- deleted 6y ago[deleted]
- simias 6y agoTo me Zig seems to be an in-between between C and Rust. It feels a lot more modern and pleasant to use than C without the rather large complexity of Rust. Of course, nothing comes free, so it's also less safe than Rust. I personally really enjoy Rust's commitment to safety and I do find that the difficulty of writing Rust code that will pass the borrow checker and its stricter type system is well worth it but I know that some people find it frustrating and not very pragmatic. If you fall in this camp then Zig might well be worth a try. Basically coming from C if you think that Rust goes too far, try Zig. If you think that Zig doesn't go far enough, try Rust.
- defen 6y agoZig's C integration story is pretty compelling - https://ziglang.org/#Integration-with-C-libraries-without-FFIbindings https://ziglang.org/#Integration-with-C-libraries-without-FF... You can call C code from Rust as well but it's not as tightly integrated into the language (and probably can't be, since C code is inherently unsafe).