- 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.
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.
For Zig to be part of that list, a story for use-after-free must exist as well.
Others won't agree with me, and that is fine, different strokes for different folks.
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.
How you structure the financials and the community around the language has also a gigantic impact on the final result, and this is an area where Zig bringing to the table something completely new.
Outside Apple computers, the dialects created by Borland gained such following, specially in Europe, that Turbo Pascal became the official Pascal dialect, even though Extended Pascal fixed most of the original design flaws.
Naturally they going enterpreisy lost the crowd to VB and VC++ folks (later .NET).
Modula-2 did have some nice offerings, specially on Amiga, but on the PC and Mac, Turbo/Object Pascal made it irrelevant as it offered all the improvements Modula-2 brought to the table (no one cared about co-routines on home computers back then).
Ada was the only one from those that yeah, actually quite expensive, and I think only SGI and SUN had UNIX compilers for them, with HP having BASIC and Pascal compilers for their OSes.
Then there was the Amsterdam Compiler Kit, the "LLVM" for the 1980's, which had support for C, Pascal, Modula-2, Occam, and BASIC.
Looking forward to see how Zig evolves, specially regarding issues like #2301.
C won due to UNIX, had UNIX not been a kind of free beer that companies could build their workstations with and universities avoid paying for commercial OSes like VMS, history would have taken a different path.
Also, lisp has pretty much always been more powerful than C. But what zig brings to the table is an extremely simple language which is also very powerful. Much of the power results from the entire language being available at compile time. You seem so ready to throw that away in favor of could-have-been nostalgia, I wonder if you've taken the time to understand what you're criticizing.
Zig isn't the only AOT compiled language with compile-time type reflection in 2021, and exactly because of could-have-been nostalgia, we don't need newer systems programming languages that don't have an answer for use-after-free in safe code.
https://github.com/ziglang/zig/issues/2301
https://github.com/ziglang/zig/issues/1966
Naturally I have taken the time, and did not come out impressed, given my background and programming language beliefs.
However as I say in another thread, other people seem to be happy with such shortcomings.
It is not a "nuanced and balanced" approach: Zig is simply not memory safe.
[1]: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#...
It's of course true that some developers may judge the tradeoffs differently for their individual projects—that's why they're tradeoffs! But there are benefits to memory safety that go beyond security.
everything else is just bloat and noise that hurts iteration time
and even if one would still value them, you'd need to check only once for whatever memory check you want to run, when you build your allocators for example, and not at every builds, and you could even write the logic yourself and have a debug allocator to ensure memory safeties
you want sub second and not "double digit seconds" build times
it takes one to try to make a game to trully understand why iteration time is far more important that anything else (other than performance of course)
you don't want to wait multiple seconds everytime you change the speed of your character, or tweak the rendering/AI code
that's why then some devs end up using scripting language and they loose all the advantages of their native language, because they want to speed up iteration time
that's why i personally stick to D for my game, my engine + game fully rebuild in under 1 second
you don't get to create memory bugs when you work on your gameplay code ;)
Disagree, but in any case, we're talking about the fact that Zig doesn't provide use-after-free protection.
Probably if your game is single-threaded …
Rust's raison d'être was type-check thread-safety, and even if we don't talk about this aspect much anymore it's still the domain where it has no competitors (Pony could have been, but didn't get traction).
And it's invaluable.
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.
[1]: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html#...
Early on, I remember dealing with lots of bugs in C compilers in the mid and late 80s. It takes time.
Otherwise it is pretty much Modula-2, with C flavoured syntax and compile time execution.
Overall, the use-after-free is what irks me.