I get what Zig is going for in making all operations as explicit as possible, but I fear that it's going to turn away fields like graphics and game development where it would be a good fit except for the lack of operator overloading forcing you to go back to C-style math function spaghetti. It's all fun and games until what should be a straightforward math expression turns into 8 nested function calls.
Zig is hard but worth it
41–50 of 307 posts
Re: Zig is hard but worth it
#42My main issue with Zig is that I’m scared to invest time in writing something nontrivial to see the community/adoption flounder then regret not using Rust or C++ later The language itself is fun. The explicit-ness of choosing how allocation is done feels novel, and comptime is a clean solution for problems that are ugly in most languages. Aside from lack of community I’d say the biggest nuisance is error handling in…
> If I use the general purpose allocator then my edge case is PC out of memory What does PC mean in this context?
Re: Zig is hard but worth it
#43> there’s not a direct correlation between the slimness of a language’s syntax and ease of learning That's absolutely true, but (the standard library aside) the "syntax" -- or, rather the syntax and core semantics -- of a programming language are arbitrary axiomatic rules, while everything else is derivable from those axioms. So while it is true that a small language can lead to a not-necessarily-easy-to-learn overal…
> Some languages (e.g. lisps) are deceptively small by relying on macros that form a "second-order" language that interacts with the "first-order" language, but Zig doesn't have that. What are some other examples of such languages that rely on second-order languages? You mentioned Lisps. Would Forth be another example? Are there more examples?
Re: Zig is hard but worth it
#44Where do you guys see good use cases for Zig? I'm intrigued by the language but don't really have any good ideas on where to try it out. I thought about trying it out in as small data engineering project, but I'm not sure if language support is sufficient for the kind of tooling I would need eg. Database adapters.
In what concerns userspace, I don't see any good case, if I want a better C, without much features, I rather stick to Go even if I dislike some of the design decisions. Or D, Nim, Swift, OCaml, Haskell, AOT C#, AOT Java,... If any kind of automatic memory isn't possible/allowed, I would be reaching out for Rust, not a language that still allows for use-after-free errors. Maybe it is a good language for those that wou…
I have come to the same conclusion but then I also fear that Rust will continue to expand in scope and become a monster language like C++. Do you or anyone fear that? Is that a possibility?
Re: Zig is hard but worth it
#45Earlier quoted context omitted.
I suppose you could write a few line wrapper that panics :) But yeah, most of the time I don't even want to think which allocator to use let alone handle it's errors.
This is basically what I've come to do in the Zig scripts I write at work. It took a bit of getting used to when I joined but we agreed as a team to have all meaningful scripts written in Zig not bash (for one, bash doesn't work on Windows without WSL and we need to support Windows builds/testing/etc.). It makes about as much sense as any other cross-platform scripting option once I got used to it! Some examples: Doc…
Re: Zig is hard but worth it
#46> "I learned Zig in a weekend! … Six hours! … 6µs!" say the blissful lizards. I don’t get it; is this a reference? Could someone explain?
Re: Zig is hard but worth it
#47> there’s not a direct correlation between the slimness of a language’s syntax and ease of learning That's absolutely true, but (the standard library aside) the "syntax" -- or, rather the syntax and core semantics -- of a programming language are arbitrary axiomatic rules, while everything else is derivable from those axioms. So while it is true that a small language can lead to a not-necessarily-easy-to-learn overal…
Now, it's definitely neat that you can do reasoning from first principles on it, but I'm not sure how much of a gain that is.
Re: Zig is hard but worth it
#48Re: Zig is hard but worth it
#49Earlier quoted context omitted.
This is basically what I've come to do in the Zig scripts I write at work. It took a bit of getting used to when I joined but we agreed as a team to have all meaningful scripts written in Zig not bash (for one, bash doesn't work on Windows without WSL and we need to support Windows builds/testing/etc.). It makes about as much sense as any other cross-platform scripting option once I got used to it! Some examples: Doc…
I am truly puzzled by this. I understood Zig to be a very low level language like 'C'. Why would you write scripts in it?
But mostly the team decided to do this because we wanted to unify on one language and double down on the investment in Zig.
I'm not a fanboy (nothing wrong if anyone is, just clarifying about myself); I think this choice was right.
Re: Zig is hard but worth it
#50I get what Zig is going for in making all operations as explicit as possible, but I fear that it's going to turn away fields like graphics and game development where it would be a good fit except for the lack of operator overloading forcing you to go back to C-style math function spaghetti. It's all fun and games until what should be a straightforward math expression turns into 8 nested function calls.
I'm no expert on zig, but the one area I have seen it shooting up in popularity is game dev. Though I guess that is largely as a replacement for C, so "C-style" wouldnt be much of a concern