4 ms·
In classic HN fashion, I will sidestep the content of the article and just say... Zig is the most productive I've ever been with a systems programming language
by LAC-Tech 4y ago
In classic HN fashion, I will sidestep the content of the article and just say...
Zig is the most productive I've ever been with a systems programming language. I've never been less frustrated dealing pointers and allocation in my life.
- jefftime 4y agoI strongly agree. I thought I would have this same feeling with Rust way back when I first learned about it, but the more I use Zig and Rust, the more I prefer the former for systems programming
- Jensson 4y agoSounds great, maybe I should take a look at zig. Rust feels too much like a data processing language instead of a systems language. Quick glance at Zig, it supports the kind of metaprogramming I always wanted in C++! Looks like regular code but guarantees to not typecheck the paths that can't be taken. Also has reflection! And since generic types are created like any other struct, you can write that metaprogramming like normal code as well! If it works as advertised then you could implement your own type constraints and type checking as regular code for those types, I always wanted to do that. Then I can implement compile time type constraints and type checking to see what the type supports and pick implementation based on that, or throw an error if the interface is passed some invalid type etc. This should make the code ultimately safer than even rust if you master this style of coding as you can move so much checking to compile time. What are the main problems with the language? This sounds great, just wanna hear what the drawbacks are.
- kristoff_it 4y agoThe worst part is that it's not done yet :^) This means that you will not find super complete introductory materials about every aspect of programming with Zig. The language reference is very good but for example the standard library doesn't have docs yet as we're still working on the autodoc tool. On the other hand reading the stdlib source code is very easy in good part thanks to the reasons you already mentioned in your post. https://github.com/ziglang/zig/wiki/How-to-read-the-standard-library-source-code https://github.com/ziglang/zig/wiki/How-to-read-the-standard... You might also be interested in reading about the project to see if you like where we're going (aside from technical details of the language). https://kristoff.it/blog/zig-new-relationship-llvm/ https://kristoff.it/blog/zig-new-relationship-llvm/ https://kristoff.it/blog/maintain-it-with-zig/ https://kristoff.it/blog/maintain-it-with-zig/ https://kristoff.it/blog/interfacing-with-zig/ https://kristoff.it/blog/interfacing-with-zig/ https://www.youtube.com/watch?v=AqDdWEiSwMM https://www.youtube.com/watch?v=AqDdWEiSwMM You can find links to learning materials in the "learn" section of the official website: https://ziglang.org/learn/ https://ziglang.org/learn/ Last but not least, at the moment we compensate the lack of learning materials by having a community that it's very good at helping newcomers, so make sure you join one of the communities.
- TulliusCicero 4y agoI have almost no systems programming experience, but I'm curious, how is it better than Rust?
- 2c2c2c 4y agoThe easiest way to put it is to just install/set up both languages, and jump into definitions of random stdlib functions.
- oconnor663 4y agoRust definitely has a steeper learning curve, and sometimes it forces you into designs that may or may not be your preferred choice. (Typically your data ownership diagram in Rust needs to look like a tree with no cycles.) Many folks who learn Rust eventually feel like "the compiler was right all along", but not everyone feels that way, and the time investment to get to that point can be a lot.
- LAC-Tech 4y agoCouldn't have written it better myself - you hit the nail on the head.
- girvo 4y agoI can't wait to see Zig become better in the embedded world. Anything to avoid having to write more C would make me happy. Until that time, Nim is my go-to, and it's quite nice as well for similar but different reasons. I think they both have their place.