Live data from Hacker News

Zig: Build System Reworked

ziglang.org

91–100 of 263 posts

Re: Zig: Build System Reworked

#91
post #43

Earlier quoted context omitted.

Is it really that good? My go-to "tinker in my garage" language is Python - lightweight syntax that stays out of your face, batteries included, packages for everything that's not included. What's Zig's edge?

The only language I've historically been able to claim to know without feeling like I'm straight up lying has been Python, and having got past my first maybe 1000 lines of Zig I can say pretty confidently that whatever magic makes Python feel comfortable to write, Zig has too. It requires more of you in some ways, notably that you have to understand the basics of memory management and the behaviour of the stack, but…

It's true that Zig is very readable. I haven't yet seriouly studied or written much of it, but browsing through codebases of popular Zig projects, a lot of it just makes sense intuitively. In that way it has a Python-like friendliness of syntax.

I enjoy the community and culture around Zig too. The other day I found a forum thread where people were sharing what they're currently building, and there were so many fun projects from small hobbyist things to large ambitious ones. For the latter, the main concern is the stability of the language, but the good thing is that everything is out in the open, everyone knows Zig hasn't reached version 1 status - but I can see concrete steps are being made to find a good solid interface, including this I/O stuff in 0.16. As someone casually learning the language, I find it refreshing to have insight into the development process.

Re: Zig: Build System Reworked

#92
post #27

Earlier quoted context omitted.

No, I get that, but Zig being low level is kind of why I don't get why it would be a good tinkering language? When I want to tinker, I just want my logic to work, first of all. In 9 cases out of 10 that means going for high level. Even if the resulting code works with low level things like binary structures.

You have a weirdly restrictive definition of "tinker"

Almost all of my tinkering is “download this thing, cache it (because it’s huge), run a program or a series of programs on it, and package the output up somewhere.” When I’m writing the thing that does the work I’m not tinkering any more..

Re: Zig: Build System Reworked

#93

Earlier quoted context omitted.

Rarely. Most tinkering tasks just don't have enough heavy duty computation in them to as much as strain a modern CPU. And most of the rest are covered by packages like numpy or pytorch. For the rare exceptions, I make a C lib and call into it to get my numbers crunched. I get that Zig is a viable replacement for C there. But I don't see it replacing Python.

> For the rare exceptions, I make a C lib The problem is that most people using Python don't have enough expertise in C to do the same. It also kinda destroys the argument that Python is good if your solution for performance is to use a different language alongside it.

The argument is that the ergonomics of using Python are worth the squeeze of learning two languages. Are the ergonomics of using Zig really enough to justify replacing Python on the happy path, or would it end up replacing just C?

Re: Zig: Build System Reworked

#94
post #18

Earlier quoted context omitted.

Have you ever thought "Ugh, this bit of Python code is running much slower than I expected on my computer. Wonder if anyone has written a native library for this"? That's probably the closest use case for someone who matches your description -- a language that is much more ergonomic, much more 'modern' feeling (in all the good ways), while still extremely compatible with C. As for the language itself, it's going to b…

That's actually a great argument for Nim[0]. Easy interop with C, native-speed performance, and a syntax very close to Python in both readability and how quickly you can get something working. Batteries included, automatic memory management without a conventional GC and metaprogramming - is a really cool combination. [0] - https://nim-lang.org/

it is my second choice next to Zig and does have a lot of cool features, for sure.

The nice thing is that all these languages feature easy C interop so you can use a C FFI as the interface between them if you want to experiment with, for example, writing a module in Nim

Re: Zig: Build System Reworked

#95

Earlier quoted context omitted.

Zig is low level, so it will certainly not replace your python usage, it is more like a modern C than anything else. There’s a video of a recent interview with Andrew Kelley, if you want to watch it to understand better what Zig is for, it’s on Jetbrains YouTube channel.

No, I get that, but Zig being low level is kind of why I don't get why it would be a good tinkering language? When I want to tinker, I just want my logic to work, first of all. In 9 cases out of 10 that means going for high level. Even if the resulting code works with low level things like binary structures.

> I just want my logic to work

what the heck has convinced you that logic is somehow flawed in a new low-level language? LOLLL

Re: Zig: Build System Reworked

#97
post #31

Earlier quoted context omitted.

Basically what the world has lost by ignoring Modula-2 and Object Pascal, and going down the C path.

The spirit of Pascal lives on in Nim. It's arguably the closest modern language (with a sizeable community) to the Wirthian languages.

There’s a spirit of Pascal in Odin, although not a sizeable community.

http://odin-lang.org/

Re: Zig: Build System Reworked

#98

Earlier quoted context omitted.

And if you really need more performance (or, more often, fast startup times), Go gives you 90% of the speed with 30% of the effort. Rust if you really want to squeeze everything that can possibly be squeezed of that CPU.

that’s not what the benchmarks say about Go, and based on multiple reports, Rust does not scale well into large codebases, which eventually become brittle and very difficult to change Zig is a return to “no magical effects,” except with reasonable safety

Link to said benchmarks?

Re: Zig: Build System Reworked

#99

Why would I want to use this over, say, Node.js and TypeScript?

I believe if the work you do fits well with Node & TS, you have no reason to use zig (other than for learning or curiosity). Like, if you don't need every drop of performance, memory layout & control, there's more downsides to using zig. Idk, cruds or "enterprise" stuff or websites don't benefit from zig.
Post reply on HN