5 ms·
Zig: What to Expect from Release Month
- travisgriggs 2y agoI’ve been a lurking fan of Zig for a while. Discovering they listen to IM and Bliss to code to just made me like their project even more.
- mgrandl 2y agoThere are so many cool projects using Zig already. Very excited for its future!
- mrcwinn 2y agoCould you list some? (This isn't the usual snarky HN "source?" question. I suspect you know more than I do and I'm also curious about Zig!)
- zellyn 2y agoTigerBeetle and Ghostty are probably the most famous.
- bb86754 2y agoBun too
- flohofwoe 2y agoJust yesterday I tinkered with making my 8-bit emulators run in a terminal (specifically Ghostty and Kitty), which is totally cool IMHO ;) https://github.com/floooh/chipz-kitty https://github.com/floooh/chipz-kitty That's one nice thing about Zig, such small experiments are quick to setup and fun to build.
- etyp 2y agoI'm excited to see how that x86 backend is, I haven't tried it yet. It's definitely an interesting step for a new language to do on its own
- hansvm 2y agoIncremental compilation!
- tomrod 2y agoCool to see! I'm interested in learning a lower level language a bit better. I've spent some time in Rust and C (not enough to be proficient) -- is Zig a good candidate? It seems to have a lot of interest, I'm curious about objective views on its long term progress and forecast.
- pitaj 2y agoZig is strictly better than C. It has a better interop story than Rust. The biggest downside right now is that it isn't stable.
- flohofwoe 2y agoIMHO the main difference where you need to "think different" compared to lower level languages like C or higher level languages like C++ and Rust is memory management. The entire Zig stdlib expects allocators to be provided by the caller and there's a handful of specialized allocators in the stdlib to pick from. This opens up a lot of flexibility for explicit memory management, but to take real advantage of this new freedom requires some experimentation and unlearning when coming from most other languages.
- dns_snek 2y agoMost of my work is in higher level languages and I never liked C due to its many quirks and footguns which made me think that I just didn't enjoy low level programming. I learned that I was wrong when I spent some time hacking around lower level programming with Zig and I thoroughly enjoyed it. It just clicks for me in ways that C and C++ never did.
- pjmlp 2y agoI was fortunate to have learnt low level programming via various BASIC, and Turbo Pascal, alongside Z80 and 8086 Assembly, that C was never special to me, other than being more cross-platform due to the way it came to be. Luckily around the same time I also got hold of Turbo C++ 1.0, and Borland's Pascal / C++ tag team is what kept me interested.
- rami3l 2y ago
- picafrost 2y agoWriting Zig has been bringing me a lot of joy. It feels like I’m working with a machine again. The memory safety guardrails are just high enough to help out without feeling like a tourist trap. There is space to enjoy writing code with someone’s PhD dissertation, untyped dynamic free for alls, and all that in between. Zig feels like a hacker's language.
- jvillasante 2y agoI've been trying to understand what Zig place is in the world so I can learn more about it. I like the idea of simplicity in programming languages but, other than that and since there's Go already, what is the proposition here? In particular: - LLVM is not enough, let's write our own compiler. - Interfaces are an overhead, use comptime instead or roll your own vtables. - In a world where "memory unsafe" languages are under attack... yeah, we don't care about that. I'm not trolling, this are serious questions from afar that I would love to figure out before investing time with Zig.
- the__alchemist 2y agoSimple answer: Anywhere you'd use C, and want a nicer language. So: embedded, operating systems, drivers, compilers, PC applications etc. I would love to try it out with a serious project, but am waiting on libs like HALs for microcontrollers, GPU API bindings, GUIs etc to mature to a usable point.
- flohofwoe 2y agoThe Zig stdlib and comptime features like generics and type inspection go way beyond C (and in parts also beyond C++ and Rust) though (e.g. Zig is much more than "just" a C replacement).
- jvillasante 2y agoWell, I use C++ for that today and don't see much benefit in switching really. Switching to a memory-safe language is something that I can support and even sell to my team, but switching to just a "simpler" language I'm not sure...
- gtirloni 2y agoThe C/C++ dropin compiler replacement in Zig now seems like a missed opportunity in Rust. Would that even be possible?
- rererereferred 2y agoRust also uses LLVM so I don't see why not. Even D has its own C compiler, does Bun too.
- LeFantome 2y agoThere are other Rust implementations that do not use LLVM. Eg. GCC and Cranelift.
- deleted 2y ago[deleted]
- the__alchemist 2y agoOk, fuck it. Today project: Porting my vector and quaternion from Rust to Zig as a learning project.
- baazaa 2y agoi feel like i'd want operator overloading when dealing with quaternions, which zig eschews for no good reason
- the__alchemist 2y agoI just hit this, within minutes of starting... A cursory search implies this is a won't-fix: https://ziglang.org/learn/overview/#small-simple-language https://ziglang.org/learn/overview/#small-simple-language Operating overloading is considered hidden control flow. I appreciate that the team set made and are adhering to principles, but it does not mitigate the downside of this omission to me. I do a lot of scientific and numerical computing, and use vectors frequently. Non-overloaded vector syntax is tough to read and write. I'm aborting. This is an unfortunate decision.
- ksec 2y ago>I'm aborting. This is an unfortunate decision LOL. At least that is 20 min of trying. ( From the first message to above )
- the__alchemist 2y agoAfter some thought, I think I know why this is irritating. The domains I imagine Zig would be suited for are also ones where I use vector operations regularly. Almost a 1:1 overlap: - Embedded (Accelerations, velocities, positions) - Robotics - Games - Performance-critical scientific and numerical code (Cosmology, computational chemistry etc) - 3D graphics and visualizations
- otoburb 2y ago
- ta8645 2y agoZig is a joy to write; it feels like a much-improved C. Writing and cross-compiling a custom app for Windows was great. The only thing I'd mention is that there is a lot of outdated information on the net for it. Zig has evolved and changed quite a bit, leaving it quite difficult to search (or chatbot) for up-to-date information on its syntax and idioms. It can be frustrating to get so many incorrect answers.
- fuzztester 2y agoimo, this is a liability for them, as well for those of us who are interested in zig, but don't want to break our heads and time reading zig (language impl, not zig src examples) source code just to understand the language features. I don't know if they (andy and co.) get it, or if they subscribe to "use the source, luke" mentality :) happy to be told I am an idiot, and don't get it, but only with good reasons :) ( as a guy who did quite a lot of C earlier, including in prod, I was interested in the goals of zig, but it should work for my needs, in the sense that I describe above. ) and I will decide what is good for me :) now, zig away!
- icsa 2y agoRegarding Aro (new C compiler in the Zig toochain), it seems that a C compiler written in Zig shortens considerably the path to supporting constexpr in C using Zig's comptime capabilities.
- anacrolix 2y agoSo professional. Also Infected Mushroom is great.