Zig's Genius plan to take over the world

Had a laugh watching this section from Tsoding latest Youtube video :slight_smile:

C++ Library that Cracked Networking

Context: Tsoding checks out the ZeroMQ networking library. His chat jokingly asks where the build.zig is and Tsoding proceeds to reveal our genius plan to take over the world :slight_smile: He’s on to us guys!

20 Likes

He was quite cynical about it, which I don’t blame him. I think a lot of these build.zig files jumped the shark a bit by pushing too early while the build system is in flux. If projects get burned by the build system API changing, they are going to avoid it even when zig is 1.0 and the experience will be nicer.
Putting it all into the AllYourCodebase org means that people don’t have to deal with the papercuts as things mature.

12 Likes

I really dislike his take. ā€œThey know what they are doingā€, who is ā€œtheyā€ in this context? Andrew, Loris or the community as whole?

As far as I understand, there was no co-ordinated push to put build.zig in every oss project. Individuals put in the work because they believe the build system is good and wanted to share it’s benefits.

It may of been annoying for for the repo owners, which is a fair observation, but it’s not as deep as tsoding is insinuating.

2 Likes

I didn’t watch the video, but ā€œYou know what you doingā€ is the line that comes after ā€œTake Off Every ā€˜ZIG’!!ā€ in the Zero Wing intro.

1 Like

You didn’t read the small print when joining this community? You are required to submit at least 1 build.zig to a C/C++ codebase per month.

16 Likes

I empathize that it can be annoying to have someone submit a PR to your repo for a build system you’re not familiar with. We actually had some discussion about this a while back and that’s when we decided to create ā€œallyourcodebaseā€ so we could still share zig build code without having to ā€œannoyā€ upstream maintainers. Most of what Tsoding said is true. It’s true we are aware that making Zig good at building C/C++ is great marketing. But, I think his misses the main reason we submit build.zig files, it’s not to promote the Zig language (at least not for me), it’s to get the benefits that the zig build system provides, namely, cross-compilation support, a package manager, and reducing build dependencies. Promoting zig is just a ā€œbonusā€ :slight_smile: The evidence that this is not only my main reason, but others as well comes from Tsoding himself. After we switched to using allyourcodebase, we no longer promote the zig language in the upstream repository like he was explaining, yet, we’re still creating these build.zig files.

In any case, I find Tsoding’s humor entertaining. I think he’s got some wrong ideas about Zig but he’s very smart/experienced and I think ā€œmostā€ of his takes/criticisms are, as he’d say, ā€œbasedā€ :slight_smile:

15 Likes

IMHO the better approach is to create a non-intrusive project which is just a build.zig.zon and build.zig. The build.zig.zon pulls the original C project, and the build.zig file builds it.

That way you don’t need to hassle the project maintainer with your pet build system (because this not only happens for build.zig, but also for CMakeLists.txt etc…) while still having an easy way to build the library.

My own POV / hot take is that C libraries should not come with any build system files at all (e.g. no Makefile, no CMakeLists.txt, no build.zig, no meson.build etc…) - since the C/C++ world never agreed on a standard build system (the closest thing is cmake, but enough people hate cmake with a passion that it will never be fully accepted).

PS: I now see that allyourcodebases is exactly that :slight_smile:

6 Likes

Yeah I think not having any build files in a C project is a valid approach. Tsoding also has his own build system pattern ā€œnob.cā€ where you copy the ā€œnob.cā€ build library into your project and write your build system in C. It’s the same idea as build.zig in reducing build dependencies, since you already need a compiler, if you use that compiler for your build system as well then you only have single dependency. The only downside is the std C library doesn’t help you much, you’ll probably miss out on build caching, package management, fetching dependencies, full cross-compilation support, smart parallelism that takes memory into account, coordinated build output, …etc, but, I’d still consider using something like nob in a cases where I couldn’t use build.zig.

6 Likes

I hear where you’re coming from.

I believe Andrew Kelley’s vision was to meet C and C++ developers where they are at. He wanted to allow the code base to remain the same and replace all the Cmake/Make/configure scripts with just one tool.

However, there’s definitely more than one perspective you can have on Tsoding’s take. To Tsoding’s point, Andrew Kelley has also described the inclusion of build.zig files as an on-ramp to get project maintainers interested in Zig.

While I’ve only been following him for a short period of time, I’m confident Tsoding has been around long enough to see many fad languages come and go. If I put myself in his shoes, I can see myself quickly becoming jaded to any new language (Zig or otherwise) being shoved in my face.

1 Like

He’s 100% correct, this has been the plan since day one.

Only difference is the plan isn’t to shove it into people’s faces, it’s to entice projects to willingly adopt it by being too useful to ignore.

24 Likes

I think it’s funny that the PR is over 2 years old, which he probably excavated for the video to whip up emotions. And it worked when you look at the comments. What you don’t do for clicks.

2 Likes

Yes, that’s the business he’s in, without a doubt.

Gotta say I love your approach, Andrew.