BTW: if anyone wants to jump into Zig, for me the most efficient way was reading the stdlib and also using github codesearch - just type a function name with suffix lang:zig and you get a real-world usage.
I just search up things I'm working with. For example, I'm learning the Erlang library "PropEr", which doesn't have great documentation. One of the main functions/macros that proper uses is ?FORALL, so I search ?FORALL in grep.app and see how people are using it. If I want to narrow the cases down, I use the regex search.
I am learning Rust RN, I wish I could see the real world examples for the topic I am learning. Can you please disclose your way of using GitHub search in detail or any resource on the topic if possible?
and I type there something like `"someMethod(" lang:zig`, then I open several results in a new tab and quickly skim through that and close the ones which are not interesting, and that's pretty much it
The most important note of this release is that Zig is now self-hosted; it is capable of compiling itself.
I've been learning Zig as a side project for a couple months now. It's been kind of hard since I don't have a lot of experience with low-level coding and Zig is a bit less user-friendly than Swift, but the folks in the IRC channel (and yes, its primary real-time chat community is an IRC channel, not some Slack/Discord nonsense) have always been super friendly with this newbie, right up to the project lead himself. I really suggest you give Zig a look if you want to have some fun learning a new language.
> and yes, its primary real-time chat community is an IRC channel, not some Slack/Discord nonsense
As a counterpoint, I have only interacted with the Discord communities and they've been great for all my dumb questions! I barely go a minute before getting a response when I ask something.
Whether you prefer IRC or Discord, it sounds like you're well supported by the chat communities.
I'm in the same boat, I've used Zig to go through AoC 2021, liked it. I know some C, as in worked through K&R years ago, but I possess little practical experience.
Any recommendations for resources/books to learn knowledge and programming patterns applicable to Zig?(memory management best practices, low level programming, et cetera)
Discord and other Electron-based chat software provide very little practical improvement over IRC for the purpose of discussion while requiring 10-100x the resources.
Not exactly that but I've been working on a collection of small but meaningful programs in major languages: github.com/eatonphil/tinyprograms. There's Zig, Rust, Go, Python, D, FreePascal, Java, Ruby, etc.
Well, Python, JS and Go all have different goals than Zig. You also can't write low-level stuff with them, mostly. Actually, you can (with TinyGo and MicroPython), but they're not what these languages are designed for so you'll most likely be on your own.
Rust is a whole another conversation. You can pretty much do whatever you can do in Zig with Rust, and Rust has the advantage of hardcore memory safety using the borrow checker. It is also a very nice language to use, but it is complicated.
You see, Zig is sort of the C to Rust's C++. I don't mean this in the sense that Zig can't replace C++ (it can) or Rust can't replace C (it can), but it is obvious that C is a simpler language to learn than C++.
So yeah, you kind of don't need Zig when you have Rust and willing to use it for everything, but if you don't want to deal with a complicated language and the borrow checker, Zig is the language for you. It is basically C with some footguns removed + some features added (tagged unions, proper error handling, etc).
Ah, and Rust has long compile times. It is being worked on since 2013 [0] or earlier. Zig is serious about their compile times as you can read about the self-hosted backends for debug compilation speed in the release notes.
I don't know if Rust has any production-ready alternative backends that are fast. People always say LLVM is the reason Rust is slow to compile and you can use cargo check to confirm that, but it is obvious that is more of a priority for Zig team when compared to Rust team.
I sort of don't care about compile times of Rust at this point since the guarentees Rust make is more important to me than the compile times, but that may not be the case for everyone. I'll also use Zig when it is stable enough for my taste for non-safety critical stuff.
Do more with less. This release already shows well-thought-out design layer shared ABI code for backends .. and optimized generated wasm looks like a killer. Small binary size than Rust, easier to optimize, "proof|correctness" can't help you here!