A Note About Zig Books for the Zig Community

7 Likes

Exciting stuff, I’ve been hoping to start hearing some word on books covering Zig, and now it sounds like a bunch may be coming!

I know you mentioned you would probably self-publish to Amazon Kindle, but would you be open to publishing multi-format? I think a good example of this is Thorsten Ball’s Writing an Interpreter/Compiler books (https://interpreterbook.com).

But whatever you decide to do, best of luck with the endeavour, and I look forward to picking up a copy when the time comes!

1 Like

Amazon Kindle Self Publishing is the service name (related but not the same as Amazon Kindle the product) and also deals with creating physical copies of the book. That said, I do plan to create a free website for it, for sure.

4 Likes

I’d buy a physical copy, if not too expensive.
Or / and a digital copy, although I don’t own a Kindle and I’m not sure Amazon book reader software runs on Linux.

The main reason I personally wouldn’t buy a book on Zig is because the standard library is very easy to read. Compare that to any code published by GCC and I probably would prefer a book at that point.

I think a very valuable body of literature (even given what I have already said) would be about migrating existing code to zig. Especially legacy code because a lot of that stuff has not changed in decades. Writing about new language features is like shooting at a moving target… especially one that is open source. Just my two cents…

As a mostly self-taught programmer with little to no C experience, I think it would really be helpful to have a book about Zig with an intro covering the C mindset. I’m not talking about a tutorial on C, but rather that C way of thinking and solving problems that is still heavily used today by many developers and that Zig could really improve and augment. I think it would be good for programmers coming from dynamic / GC languages in which problems are solved in a very different (often carefree but inefficient) way.

4 Likes

I think a very valuable body of literature (even given what I have already said) would be about migrating existing code to zig.

A chapter (or two) in this possible book could cover this topic. Right now I’m chewing my way through C + Zig compilation and linking, and though I’ve figured out the basics, I still have questions. For example, how do I pass arguments to the linker, a-la gcc’s -Wl.

Writing about new language features is like shooting at a moving target…

Yes. Many parts of this hypothetical book would be obsolete within a year.

especially one that is open source.

Open source is a positive trait, not a negative. Imagine Zig standard library, but you can’t read its source code :grimacing:.

2 Likes

Yup, I agree that open source is a good thing too. I made that point to mention that trying to track menial details about an open source language (given how fast they can rapidly iterate through versions) would be problematic for the longevity of a book. I much prefer a language being developed out in the open as opposed to in the dark. So we agree :smiley: I could have been a bit more clear about what I meant by that statement.

2 Likes

A book in Zig mainly focused on Data Structures and Algorithms. Majority of books are written in Python or C where one just introduces the broad topic and the other is too intimidating for beginners. I believe Zig, with it being a small language and a better syntax then C, is a good choice.

Possibly tailored to the younger programmers still in middle school or high school. Veteran programmers are hard to win over.

1 Like

LOL :slight_smile:

It’s not that true.
I’m >50 old fart (~25 yrs of active developement in C) and I clearly see Zig is the best follower of C. DIXI :slight_smile:

2 Likes

Hey dude, have you ever heard of constructive conversations?

Clearly there’s nuance to this - like any topic for that matter - you are clearly the more adventurous compared to the people I’ve worked with that are around the same age. There are veterans that are set in their ways and that’s totally fine too. C clearly is still a powerful language, I code in it from time to time.

No. You’ve over-estimated me.

Ofcrs, but, nvthlrs, Zig is a real possible C (and C++, heaven forbid) replacer, we’ll see.

Replace C? Highly doubt it. Alternative? Yes. A language like C will not die off like Perl. Probably like COBOL given that too much code has been written in it and it’s everywhere.

I think this is an extremely relevant topic to cover. It would make sense in a book alongside an introduction to the C compilation model. The main problem relative to this topic is that our own linker / build system interface is likely to change so writing too early about it will also require to update the corresponding section(s) sooner than later.

For the next-next release (0.12) we’re planning to start bundling handwritten guides alongside autodoc and those should include a guide for how to use the build system to deal with C/C++ projects. It won’t contain a full introduction to what’s a C compilation unit etc, but it will be an up-to-date guide to the API exposed by Zig.


For my book I’m not going to cover any of that though, my target audience is going to be Python/JS developers who want to get started with Zig but who have no idea how to do manual memory management, etc.

10 Likes

I meant replacing it in brains of C-addicted programmers, not in the “industry”.
C++ programmers also wiil be happy without all that STL/OOP/ADD-YOUR-SELF-THE-STUFF-YOU-HATE-IN-C++

1 Like

Anyways, discussing this here is way off topic. To be or not to be. The only thing I know is that it’s the systems programming language I’m focusing on for the foreseeable future.

It is a great language for a CS&A book. I’ve been dabbling in implementing a basic relational database in Zig since the bread and butter of a database is a B-Tree, I might make that the content of the book I wanted during my studies.

sure, dude ,-)

Another thing I would like to mention here is the books written by Jason Turner. First, he has a very short book (about 100 pages) of practical tips that answer common problems. The book now has extended content in the form of a github repo (GitHub - cpp-best-practices/cppbestpractices: Collaborative Collection of C++ Best Practices. This online resource is part of Jason Turner's collection of C++ Best Practices resources. See README.md for more information.), but I still bought the pdf when it first came out.

I’m recommending this book as a good example of digestible and useful content - I read the whole thing in two sittings and walked away a few great tips.

2 Likes

Makes sense, absolutely.

Wouldn’t any developer who learns Zig be interested in Zig build system, regardless of their background?

I’m definitely in that market, a lot of what I do (including professionally) is .NET/C#/JavaScript so while I’m comfortable working in C-like languages the majority of my experience is in garbage collected, heavily abstracted languages with huge libraries that do a lot of the heavy lifting for me.

In fact, one of the main attractions to Zig for me was that I lose a lot of that but in doing so I’ll be able to build incredibly efficient code and better understand how I’m interacting with the OS/CPU/RAM when I do.

I’m genuinely excited to see what people are going to be writing!

2 Likes