Remix.run Logo
daft_pink 3 days ago

I think the underlying question is why move to Zig from a C variant?

There is a lot of research showing that a high percentage of security bugs are from memory safety issues across many different studies. I believe this is why people are pushing moving to Rust.

However, if you don’t get the memory safety in Zig. Why bother moving from your existing coding language? Why not just not learn a new language and code where you are?

bsder 3 days ago | parent | next [-]

> I think the underlying question is why move to Zig from a C variant?

Null pointers disallowed by default. Slices. Superb cross-compilation. Easy C interop. Comptime instead of C preprocessor.

There are lots more.

The problem Rust is up against is that the number of people who want Rust simply because of "strict typing" far, far, far outnumbers those who care about safety or speed. And that leads to the issue that most people really should be using a GC language like OCaml rather than Rust.

Unfortunately, the OCaml ecosystem ... :(

mattwilsonn888 3 days ago | parent | prev [-]

I don't use Zig, but I can answer your questions:

Because Zig is a better language across the board.

And that includes safety. You can have a language that doesn't do heavy static-analysis like Rust which still makes safety a lot easier than C/C++.

Memory safety is not even a flaw of C/C++, it's a tradeoff. That being said, even if memory-safety was a 'feature' (rather than a tradeoff, and yes, Rust did a better job minimizing the trade than GC or FP languages), it's not the only feature.