Live data from Hacker News

Open-source Zig book

zigbook.net

251–260 of 426 posts

Re: Open-source Zig book

#251

Earlier quoted context omitted.

One is Zig the other is Zigbee, I don't understand your comment...

https://stockshed.com/products/t3542-zig-2-4-ghz-wireless-me... I think ZigBee uses Zig. It's an implementation.

The page you've linked is very confusing, but as far as I can tell that's a Zigbee device that the manufacturer (Tensor plc) consistently describes as a "Zig" device. I have no idea why, it's bizarre.

- This thesis [1] identifies a product in this family as a Zigbee device. It's on the 80th page (numbered 62). Elsewhere it's referred to as a Zig device.

- I can't find anyone else claiming to make Zig devices or any references to a Zig protocol outside of this one manufacturer and their distributors.

- The manufacturer makes a lot of weird typos. They variously say these devices operate at 2.4GHz, 2.4MHz, and 2.4Mhz.

- There's nothing about a Zig protocol on the Zigbee Wikipedia page.

[1] https://theses.ncl.ac.uk/jspui/bitstream/10443/4329/1/Liang%...

Re: Open-source Zig book

#252

Earlier quoted context omitted.

There is nothing new under the Sun. However, some languages manifest as good rewrites of older languages. Rust is that for C++. Zig is that for C. Rust is the small, beautiful language hiding inside of Modern C++. Ownership isn't new. It's the core tenet of RAII. Rust just pulls it out of the backwards-compatible kitchen sink and builds it into the type system. Rust is worth learning just so that you can fully experi…

I don't know man, Rust's borrowing semantics are pretty new under the sun, and actually do change the way you think about software. It's a pretty momentous paradigm shift. Zig is nice too, but it's not that.

There were languages with lifetimes and borrowing mechanics before Rust. Rust packages these mechanics in a nice way. Just like Zig encodes many niceties in a useful C language (comptime, simple cross-compilation, stdlib).

Re: Open-source Zig book

#253
> Learning Zig is not just about adding a language to your resume. It is about fundamentally changing how you think about software.

Written by ChatGPT?

Re: Open-source Zig book

#254
post #4

It looks cool! No experience with Zig so can't comment on the accuracy, but I will take a look at it this week. Also a bit annoying that there is no PDF version that I could download as the website is pretty slow. After taking a look at the repository ( https://github.com/zigbook/zigbook/tree/main ), each page seems to be written in AsciiDoc, so I'll take a look about compiling a PDF version later today.

If there is a PDF version, please remember to give me one. Thank you in advance.

zigbook.pdf => https://files.catbox.moe/gobtw7.pdf

HOWTO: The text can be found per-chapter in `./pages/{chapter}.adoc` but each chapter includes code snippets found in a respective `./chapters-data/code/{chapter}/` subdirectory. So, perhaps a hacky way to do it but quite lazy to fully figure asciidoctor flags, created using a script a combined book.adoc that includes all others with `include::{chapter}.adoc` directives, then run `asciidoctor-pdf -a sourcedir=../chapters-data/code -r asciidoctor-diagram -o book.pdf ./pages/book.adoc`.

Re: Open-source Zig book

#255

Earlier quoted context omitted.

I don't know man, Rust's borrowing semantics are pretty new under the sun, and actually do change the way you think about software. It's a pretty momentous paradigm shift. Zig is nice too, but it's not that.

To call Rust syntax beautiful is a stretch. It seems that way in the beginning but then quickly devolves into a monstrosity when you start doing more complex things. Zig on the other specifically addresses syntax shortcomings in part of C. And it does it well. That claim of rust making C more safe because it’s more readable applies to Zig more than it does to Rust. I feel like the reason the rust zealots lobby like c…

> if other languages that address one of the main rust claims without all the cruft

But regardless of how much one likes Zig, it addresses none of the problems that Rust seeks to solve. It's not a replacement for Rust at all, and isn't suitable for any of the domains where Rust excels.

Re: Open-source Zig book

#256

> Learning Zig is not just about adding a language to your resume. It is about fundamentally changing how you think about software. I'm not sure what they expect, but to me Zig looks very much like C with a modern standard lib and slightly different syntax. This isn't groundbreaking, not a thought paradigm which should be that novel to most system engineers like for example OCaml could be. Stuff like this alienates p…

There is nothing new under the Sun. However, some languages manifest as good rewrites of older languages. Rust is that for C++. Zig is that for C. Rust is the small, beautiful language hiding inside of Modern C++. Ownership isn't new. It's the core tenet of RAII. Rust just pulls it out of the backwards-compatible kitchen sink and builds it into the type system. Rust is worth learning just so that you can fully experi…

> Rust and C++'s biggest mistake, not passing allocators into containers and functions

Rather, basing its entire personality around this philosophy is Zig's biggest mistake. If you want to pass around allocators in C++ or Rust, you can just go ahead and do that. But the reason people don't isn't because it's impossible in those languages, it's because the overwhelming majority of the time it's a lot of ceremony for no benefit.

Like, surely people see that in C itself there's nothing stopping anyone from passing around allocators, and yet almost nobody ever does. Ever wonder why that is?

Re: Open-source Zig book

#257
post #255

Earlier quoted context omitted.

To call Rust syntax beautiful is a stretch. It seems that way in the beginning but then quickly devolves into a monstrosity when you start doing more complex things. Zig on the other specifically addresses syntax shortcomings in part of C. And it does it well. That claim of rust making C more safe because it’s more readable applies to Zig more than it does to Rust. I feel like the reason the rust zealots lobby like c…

> if other languages that address one of the main rust claims without all the cruft But regardless of how much one likes Zig, it addresses none of the problems that Rust seeks to solve. It's not a replacement for Rust at all, and isn't suitable for any of the domains where Rust excels.

> and isn't suitable for any of the domains where Rust excels.

That's a pretty bold claim since Zig is specifically designed for systems programming, low level stuff, network services, databases (think Tigerbeetle). It's not memory safe like Rust is, but it comes with constructs that make it simple to build largely memory safe programs.

Re: Open-source Zig book

#258

> Learning Zig is not just about adding a language to your resume. It is about fundamentally changing how you think about software. I'm not sure what they expect, but to me Zig looks very much like C with a modern standard lib and slightly different syntax. This isn't groundbreaking, not a thought paradigm which should be that novel to most system engineers like for example OCaml could be. Stuff like this alienates p…

I guess comptime is a little different but yeah I wouldn't say it fundamentally changes how you think about software. I wouldn't say that about OCaml either really though. It's not wildly different in the way that e.g. Lean's type system, or Rust's borrow checker or Haskell's purity is.

D has similar comptime capabilities if I recall correctly and proceeds Zig by almost 2 decades or so.
Post reply on HN