←back to thread

Open-source Zig book

(www.zigbook.net)
692 points rudedogg | 3 comments | | HN request time: 0s | source
Show context
poly2it ◴[] No.45951222[source]
> 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 people who want a technical justification for the use of a language.

replies(10): >>45951231 #>>45951258 #>>45951302 #>>45951388 #>>45951755 #>>45951799 #>>45951814 #>>45951964 #>>45952563 #>>45952740 #
obviouslynotme ◴[] No.45951388[source]
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 experience that lens of software development.

Zig is Modern C development encapsulated in a new language. Most importantly, it dodges Rust and C++'s biggest mistake, not passing allocators into containers and functions. All realtime development has to rewrite their entire standard libraries, like with the EASTL.

On top of the great standard library design, you get comptime, native build scripts, (err)defer, error sets, builtin simd, and tons of other small but important ideas. It's just a really good language that knows exactly what it is and who its audience is.

replies(5): >>45951424 #>>45951440 #>>45951718 #>>45952038 #>>45952891 #
simonask ◴[] No.45951718[source]
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.

replies(4): >>45951766 #>>45952000 #>>45952259 #>>45952444 #
rjzzleep ◴[] No.45951766[source]
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 crazy to embed rust everywhere is twofold. One is that they genuinely believe in it and the other is that they know that if other languages that address one of the main rust claims without all the cruft gains popularity they lose the chance of being permanently embdedded in places like the kernel. Because once they’re in it’s a decade long job market

replies(6): >>45951822 #>>45952027 #>>45952267 #>>45952271 #>>45952301 #>>45959444 #
kibwen ◴[] No.45952027[source]
> 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.

replies(1): >>45952063 #
sgt ◴[] No.45952063[source]
> 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.

replies(3): >>45952227 #>>45952544 #>>45953044 #
1. ViewTrick1002 ◴[] No.45953044[source]
Given the density of memory issues in the Bun issue tracker I have a hard time squaring the statement that Zig makes it "easy" to build memory safe programs.

https://github.com/oven-sh/bun/issues?q=segfault%20OR%20segm...

replies(1): >>45953905 #
2. nvlled ◴[] No.45953905[source]
> https://github.com/oven-sh/bun/issues?q=segfault%20OR%20segm...

It should be noted that most of those issues are created by opening a link that bun creates when it crashes, they are not yet reviewed/confirmed and most likely a lot of them are dulplicates of the same issue.

replies(1): >>45953956 #
3. ViewTrick1002 ◴[] No.45953956[source]
Comparing Deno most of their segfaults come from having to integrate with V8, and their density is a fraction compared to Bun.