Earlier quoted context omitted.
> and should not try zig? Because it isn't memory safe. I honestly think it's beyond the point of "irresponsible" and well into "negligence" that we're still developing unsafe technologies - people are being harmed by this choice. It's one thing when you have to target specific platforms and maybe Rust wasn't an option or whatever, but the reasons to choose unsafe languages at this point are vanishingly small. Zig is…
thank you for this truly deranged comment
Zig: Build System Reworked
251–260 of 263 posts
Re: Zig: Build System Reworked
#252Earlier 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.
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.
Linked lists are a lot less slow if you use Arena allocation around your hotspots and make sure to allocate space for as many as you thing you need, since they will be carved out of a contigious block of memory and will stay in CPU cache.
Golang also requires you to write more code, as it lags Zigs try operator.
Re: Zig: Build System Reworked
#253Why would I want to use this over, say, Node.js and TypeScript?
Re: Zig: Build System Reworked
#254Re: Zig: Build System Reworked
#255Earlier quoted context omitted.
roc lang looks very interesting, I see they use a lot of Zig and Rust, very unusual combo I think.
I think they are switching from Rust to Zig. I don’t recall exactly, but they talked about it in a video where the creator of Roc interviewed the creator of Zig. https://www.youtube.com/watch?v=w74rC-6caxE
Re: Zig: Build System Reworked
#256Earlier quoted context omitted.
A large, complex, unasked for PR is pretty likely pointless to throw at any serious project. (Well, it's pointless if your goal is to merge something.) Working together is a two-way process. To land a big change, the bun people probably needed to have been working/coordinating with the zig people throughout. E.g., zig outright cannot accept PRs that break the language in unplanned ways and any conflicts with the road…
Of course, and it is expected that large pull requests/RFCs are iterated on. I will not believe Bun seriously asked for a pull request to be merged with absolutely no expectation of back and forth discussion. But this isn’t what happened. The whole reason everyone thought it was rejected by Zig because Bun used LLM to generate it was because they responded in a way that someone would if they didn’t want a certain pul…
Re: Zig: Build System Reworked
#257Earlier quoted context omitted.
Zig gives you more control than Rust, which should theoretically lead to a higher performance ceiling. There's not much magic in Zig. Keep hitting goto-definition and you can eventually see the OS switch statements and syscalls.
Neither Rust nor Zig give you any more control than the other. If you want raw pointers or inline assembly, Rust supports that.
Re: Zig: Build System Reworked
#258Earlier quoted context omitted.
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
I would be very surprised to see a large Rust codebase being harder to maintain than a large Zig codebase. The former makes it much easier to maintain invariants at scale.
Re: Zig: Build System Reworked
#259Earlier quoted context omitted.
Why not just comment out variables you "want to keep around" but are not used anywhere?
it's just annoying to have to do that.
Overall the code gets smaller and easier to understand when it only has things that need to be there. If you comment out a an unused variable you can see from find-results that in effect that occurrence cannot matter.
Unused variables are "noise" that hide actually important things.
Re: Zig: Build System Reworked
#260Earlier quoted context omitted.
Neither Rust nor Zig give you any more control than the other. If you want raw pointers or inline assembly, Rust supports that.
Technically true, but unsafe Rust is much harder to deal with because it makes assumptions (sometimes very non-obvious) regarding aliasing that Zig does not. You might think you can avoid problems by using T* rather than T&, but every accessible local is effectively a T& so it's still very easy to do something you're not supposed to.
No, I'm not sure where you heard this but this is certainly not the case. If I have an i32 on the stack in Rust, there are no aliasing invariants that need to be upheld. You do, in fact, avoid problems in unsafe Rust by just using raw pointers instead of references. The idea that "unsafe Rust is harder to deal with than {Zig, C, C++}" is a long-outdated notion from old versions of Rust, before there was a dedicated way to produce a raw pointer without first producing an intermediate reference.