Is it easy to learn a zig for go programmer

The hardest parts of learning Zig are probably the same for most programmers regardless of background. I say this because I’ve analyzed our help topics in the past and we get similar questions across the spectrum.

Basic things (making variables, using loops, defining functions) are all very easy. Anyone with basic programming knowledge can pick up these parts quite easily. However, in C++ and Rust, meta-programming is seen as advanced/difficult - in Zig, it’s really quite easy.

Runtime polymorphism in Zig is harder at first. In C++, people use virtual inheritance (inheritance using virtual tables, essentially). It’s good to learn some patterns in Zig for polymorphism (using @fieldParentPtr or anyopaque with closures to recast to parent classes… etc).

There’s often a lack of familiarity with using and picking allocators. This isn’t just a Zig problem though - people don’t commonly think about allocation at a granular level these days.

We also get a lot of questions surrounding casting and byte alignment. This, however, is tricky regardless of what language one is working in because they require a more fundamental understanding in general.

4 Likes