- Low level
- great C interop
- Good toolchain ergonomics, except for no pkg manager yet
- Great cross-compilation
- Fast compilation (incremental coming soon)
- Ideal for things where ownership rules can get complicated (ECS e.g.)
- Fast compilation: isn't it llvm? So how faster compared to C++/Rust/others that use it?
- Ownership rules/ECS: what about zig makes this especially good? The only language that comes to mind in this respect is Rust and its borrow checker, is it similar in Zig?
2. Zig doesn't have ownership rules, which can get in the way of important data structures for gaming.
For example, Zig offers spatial memory safety, and provides test allocators to catch temporal memory safety issues. That's already an order of magnitude improvement over C.
Memory safety is also just one aspect of safety, whereas sometimes programmers conflate the two. It's important, but things like checked arithmetic should also be right up there, and should be enabled by default in safe build modes. I think Zig's approach here is also spot on, having worked a little in security, where an integer overflow can be almost as dangerous as a buffer overflow. Yet I don't see many other languages taking checked arithmetic as seriously as Zig does.
Sad that we have to go in circles to keep programming fashion going, instead of adopting best practices from the get go.
It is not a "nuanced and balanced" approach: Zig is simply not memory safe.
[1]: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#...
[1]: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#...
We deserve and can afford a lot more comfort than Pascal (and siblings) provides. Incidentally, modern language ergonomics also adds much in the way of coding safety, making usage of explicit allocation control a more manageable problem than it was 30 years ago.
While there is some truth to that, if that's the only analysis you're willing to do, then you're going to fail spectacularly hard at recognizing the advantages of TypeScript over JS, for example. Zig and C share a similar relationship across many axes, including memory safety.
Otherwise it is pretty much Modula-2, with C flavoured syntax and compile time execution.
Overall, the use-after-free is what irks me.
Early on, I remember dealing with lots of bugs in C compilers in the mid and late 80s. It takes time.