Hello ppl of the Zig community. I need to know how to be more professional in my approach to coding in ziglang and by that I mean coding conventions, filing conventions ( for example : how do I proceed with the root.zig file ) and a lot of that kind of stuff. So, I am asking to know if had been sitting under a rock this whole time, and there is a forum out there for it?
Thanks and may your codes be as bug free as they can be.
I would say at this point in time while the language is changing especially with 16.x that a lot of conventions are simply learned over time still. I picked up Zig maybe 10 months ago and the changes in that time really rather, enormous. Some of those conventions are gone and new ones are arriving.
If you are looking for style related than the docs has a section for style:
If you are looking for design patterns checkout this thread:
For everything else I would recommend reading the Docs in their entirety and then go read the relevant source code from std. You will pick up a lot of really good information from just reading std.
Personally coming from a Rust/Webdev background I didn’t find allocators hard so much as base memory concepts like *anyopaque, alignment, pointer casting, closures, etc… For that I really recommend just having Ziggit around and searching through the forum for the answer, and sometimes depending on what you are trying to do you may be the one finding out that answers.
For comp time related topics, there are some really good youtube videos out there, but really I think the one thing that helped me better understand how comptime worked was building my own things and also referring to this repo:
While it is not in anyway a how to or documentation, the techniques used in this repo really helped me better explore the comptime space and learn what it is capable of.
Really in order of importance:
Do ziglings>Zig documentation>Patterns Link>Read lots of source>any llm.
LLms aren’t super super helpful in zig as the language changes so much between versions still and even then LLM’s kind of break down on the large context that is required to work with zig.
Definitely keep an eye on 0.16 comin sometime in the next months I guess, the release of it is a gigantic moment for the language IMO. Some amazing design choices, that I truly believe will be praised in the decades to come, were made by some brilliant guys.
I’m not the right person here to give you guidance on this but if it was me I would start using master right away atm so that you start immediately with the new IO interface and so on.
I hear that and tbh I am kindof exited and preparing for the new IO already. I been learning to use the laninsky/zio lib that has the same async io approach. As of now I am coding in zio and later i just plan on going over the slight changes i would need to do to subs zio for std.io. Ik that I could just use the master but I fear async is something of a new concept to me, as of recently I was under the false pretence that it is was an alias for multi threading but now that I am giving it a go. For now I feel more comfortable with a stable external library like zio.