| ▲ | Zig – io_uring and Grand Central Dispatch std.Io implementations landed(ziglang.org) |
| 205 points by Retro_Dev 6 hours ago | 34 comments |
| |
|
| ▲ | BrouteMinou 3 hours ago | parent | next [-] |
| I feel like it's worthless to keep up with Zig until they reach 1.0. That thing, right here, is probably going to be rewritten 5 times and what not. If you are actively using Zig (for some reasons?), I guess it's a great news, but for the Grand Majority of the devs in here, it's like an announcement that it's raining in Kuldîga... So m'yeah. I was following Zig for a while, but I just don't think I am going to see a 1.0 release in my lifetime. |
| |
| ▲ | lukaslalinsky 2 minutes ago | parent | next [-] | | I really love Zig the language, but I'm distancing myself from the stdlib. I dislike the breakage, but I also started questioning the quality of the code recently. I was working on an alternative I/O framework for Zig over the last months, and I was finding many problems that eventually led to me trying to not depend on stdlib at all. | |
| ▲ | flohofwoe an hour ago | parent | prev | next [-] | | IME Zig's breaking changes are quite manageable for a lot of application types since most of the breakage these days happens in the stdlib and not in the language. And if you just want do read and write files, the highlevel file-io interfaces are nearly identical, they just moved to a different namespace and now require a std.Io pointer to be passed in. And tbh, I take a 'living' language any day over a language that's ossified because of strict backward compatibility requirements. When updating a 3rd-party dependency to a new major version it's also expected that the code needs to be fixed (except in Zig those breaking changes are in the minor versions, but for 0.x that's also expected). I actually hope that even after 1.x, Zig will have a strategy to keep the stdlib lean by aggressively removing deprecated interfaces (maybe via separate stdlib interface versions, e.g. `const std = @import("std/v1");`, those versions could be slim compatibility wrappers around a single core stdlib implementation. | | |
| ▲ | pron an hour ago | parent [-] | | > I take a 'living' language any day over of a language that's ossified because of strict backward compatibility requirements Maybe you would, but >95% of serious projects wouldn't. The typical lifetime of a codebase intended for a lasting application is over 15 or 20 years (in industrial control or aerospace, where low-level languages are commonly used, codebases typically last for over 30 years), and while such changes are manageable early on, they become less so over time. You say "strict" as if it were out of some kind of stubborn princple, where in fact backward compatibility is one of the things people who write "serious" software want most. Backward compatibility is so popular that at some point it's hard to find any feature that is in high-enough demand to justify breaking it. Even in established languages there's always a group of people who want somethng badly enough they don't mind breaking compatibility for it, but they're almost always a rather small minority. Furthermore, a good record of preserving compatibility in the past makes a language more attractive even for greenfield projects written by people who care about backward compatibility, who, in "serious" software, make up the majority. When you pick a language for such a project, the expectation of how the language will evolve over the next 20 years is a major concern on day one (a startup might not care, but most such software is not written by startups). | | |
| ▲ | flohofwoe 44 minutes ago | parent [-] | | > The typical lifetime of a codebase intended for a lasting application is over 15 or 20 years (in industrial control or aerospace). Either those applications are actively maintained, or they aren't. Part of the active maintenance is to decide whether to upgrade to a new compiler toolchain version (e.g. when in doubt, "never change a running system"), old compiler toolchains won't suddenly stop working. FWIW, trying to build a 20 or 30 year old C or C++ application in a modern compiler also isn't exactly trivial, depending on the complexity of the code base (especially when there's UB lurking in the code, or the code depends on specific compiler bugs to be present - e.g. changing anything in a project setup always comes with risks attached). | | |
| ▲ | pron 33 minutes ago | parent [-] | | > Part of the active maintenance is to decide whether to upgrade to a new compiler toolchain version Of course, but you want to make that as easy as you can. Compatibility is never binary (which is why I hate semantic versioning), but you should strive for the greatest compatibility for the greatest portion of users. > FWIW, trying to build a 20 or 30 year old C or C++ application in a modern compiler also isn't exactly trivial I know that well (especially for C++; in C the situation is somewhat different), and the backward compatibility of C++ compilers leaves much to be desired. |
|
|
| |
| ▲ | wiseowise 4 minutes ago | parent | prev | next [-] | | > but for the Grand Majority of the devs in here, it's like an announcement that it's raining in Kuldîga... Lol, I’ll borrow this. | |
| ▲ | warent 2 hours ago | parent | prev | next [-] | | For what it's worth, Bun is written in Zig (https://bun.sh/). The language isn't exactly in an early stage. | | | |
| ▲ | pmarreck 7 minutes ago | parent | prev | next [-] | | An AI will be able to handle updating your code for 95% of your breaking changes | |
| ▲ | pygy_ 2 hours ago | parent | prev | next [-] | | I wouldn't have expected graphic sex slang to be acceptable as a NH user name. This would translate as ~"eats pussy", where "broûter" is a verb reserved for animals feeding on grass, implying a hefty bush. | |
| ▲ | radarroark 16 minutes ago | parent | prev [-] | | Pretty typical jaded HN comment there, chief. "This language's churn is more than I prefer -- why would anyone use it?" If you're not interested, just downvote and move on. Wondering out loud why anyone would actively use it ("for some reasons?") is a lame waste of bytes. |
|
|
| ▲ | lukaslalinsky 3 hours ago | parent | prev | next [-] |
| I don't want to be the negative guy, but this is news about two unfinished implementations. There is a lot of work needed for this to be considered done. For example, no networking in the GCD version yet. And as these are being implemented, the interface stops being an interface, the vtable keeps growing, and it's just the current snapshot of what's needed by the std implementations. |
| |
| ▲ | hu3 an hour ago | parent [-] | | They aknowlege that at the beggining of the post? > They are now available to tinker with, by constructing one’s application using std.Io.Evented. They should be considered experimental because there is important followup work to be done before they can be used reliably and robustly: And then they proceed to list 6 important pending work to be done. | | |
|
|
| ▲ | small_model 2 hours ago | parent | prev | next [-] |
| I like Zig, lots of great features that work in unison. However the worry is by the time it reaches v1 Rust will have consumed the space that C/C++ used to. I think it will be a mainstream language though and gain a lot more traction after v1. There is also the issue of will people actually code by then. |
| |
| ▲ | pmarreck 2 minutes ago | parent | next [-] | | That won't happen if there are legitimate reasons why both Mitchell Hashimoto (creator of Ghostty etc.) and Richard Feldman (of Elm fame, creator of Roc-lang) chose Zig over Rust for their work. They both blogged about it https://tomas-svojanovsky.medium.com/mitchell-hashimoto-go-a... https://www.youtube.com/watch?v=dJ5-41u-e7k https://weeklyrust.substack.com/p/why-roc-is-moving-away-fro... Perhaps there is room for both... via C FFI interop, of course, lol (C FFI will probably long outlast C itself...) | |
| ▲ | flohofwoe an hour ago | parent | prev | next [-] | | I think Rust and Zig really don't overlap much when it comes to target audience. E.g. if you're attracted to Rust, you'll probably find Zig terrible (and the other way around). Rust will also never replace C or C++ in any meaningful way, at best new code gets written in new languages (and Rust being only one among many, and among languages used for new projects will also be C and C++, just maybe not that often). I think the era of 'pop star languages' is over, the programming language future is highly diverse (and that's a good thing). | | |
| ▲ | sgt 8 minutes ago | parent [-] | | > I think Rust and Zig really don't overlap much when it comes to target audience. E.g. if you're attracted to Rust, you'll probably find Zig terrible (and the other way around). This is ironic since these two crowds are mostly solving the same type of problems. It's just democrats vs republicans type of split, some of it is just for show and philosophical. |
| |
| ▲ | zozbot234 an hour ago | parent | prev | next [-] | | The more compelling scenario is one where the unsafe subset of Rust itself becomes roughly as easy to use as Zig is today, though still with potential challenges wrt. properly interacting with safe code. That requires literally rethinking every language and standard library facility and asking "is this putting up artificial roadblocks or even invoking straight UB when one tries to use it idiomatically in unsafe contexts?", then coming up with more flexible, more "C like" facilities in that case. It's hard work but quite doable. | |
| ▲ | pron an hour ago | parent | prev | next [-] | | > the worry is by the time it reaches v1 Rust will have consumed the space that C/C++ used to Given that Rust is quite an old language now and its adoption is still so low, I don't think that should be much of a worry, although that doesn't mean Zig will be the option of choice, and not stabilising is certainly not a good sign. At Rust's adoption rate, a language that hasn't been invented yet and that would show a more normal rate of adoption for a popular language could easily overtake it. > There is also the issue of will people actually code by then. Now that could be a bigger issue. :) | |
| ▲ | cies 2 hours ago | parent | prev | next [-] | | I don't think Rust is "a better C/C++". It's a new kind of beast. Interesting, but very different. Zig OTOH is clearly, to me at least (opinion alert), a "better C". It even compiles C! I expect LLMs to be really good at converting C to Zig. > There is also the issue of will people actually code by then. LLMs don't take responsibility. So even if code is generated, a human will have to assess it. I think assessing Zig is easier than assessing C, which gives this language a selling point that holds out in the AI assisted programming future. | | |
| ▲ | flohofwoe 40 minutes ago | parent [-] | | > I don't think Rust is "a better C/C++". It's a new kind of beast. Interesting, but very different. The same can be said about Zig's comptime. It's entirely unlike anything C, C++ or Rust has to offer. > I expect LLMs to be really good at converting C to Zig. While it's possible to translate C to Zig code - and you don't need an LLM for that, it's a Zig compiler/build-system feature - the result will be quite different from a project that's developed in Zig from the ground up since the translation output wouldn't make use of Zig's unique features (and Zig isn't really unique as 'C translation target', C can also be translated to unsafe Rust, or even to Javascript - see early Emscripten versions). Also, the 'C compatibility' of Zig is implemented via a separate compiler frontend, Rust toolchains could do exactly the same thing by integrating the Clang frontend into the Rust compiler. | | |
| ▲ | zozbot234 28 minutes ago | parent [-] | | Using the same language for compile-time and run-time programming is compelling, but doing it properly requires using the same approaches that dependently typed languages use. Comptime is a bit half baked. | | |
| ▲ | flohofwoe 23 minutes ago | parent [-] | | It's not just about writing imperative code that runs at compile time, the actual interesting comptime feature in Zig is that "types are comptime values", e.g. you can inspect types and build new types with regular (comptime) code. This is very different from the template/trait systems in C++ and Rust. What Zig's comptime system is missing is the ability to build functions bodies at comptime (e.g. some sort of comptime AST builder). | | |
| ▲ | zozbot234 18 minutes ago | parent [-] | | "You can inspect types and build new types at compile time" is a key affordance of dependently typed languages. |
|
|
|
| |
| ▲ | testdelacc1 an hour ago | parent | prev [-] | | I wouldn’t worry about that. There’s plenty of software yet to be written, in many languages. If anything, Rust’s success has shown that it’s definitely possible for a new language to succeed if it offers something new. The other tailwind for Zig is that it’s easier than ever to translate an existing codebase with tests into a new language with AI. |
|
|
| ▲ | Cloudef 30 minutes ago | parent | prev | next [-] |
| I like that zig takes freestanding target seriously. And seems like 0.16 becomes even better for freestanding code reusability. |
|
| ▲ | jauntywundrkind 3 hours ago | parent | prev | next [-] |
| Contrary to the neggies, I am positive in Zigs effort to iterate & improve. Right now there is no language that is good at io-uring. There are ok offerings, but nothing really has modern async joy that works with uring. Whoever hammers out a good solution here is going to have a massive leg up. Rust is amazing in so many ways but it has been quite a brutal road to trying to support io-uring ok, and efforts are still a bit primitive, shall we say. If Zig can nail this down that would be fantastic!! I would way rather Zig keep learning and keep changing, keep making new and better. Than to have it try to appease those who are too conservative for the project, unwilling to accept change and improvement, people focused on stability. It takes a lot of learning to make really good systems, to play with fit and finish. Zig is doing the good work. Imo we ought be thankful. |
| |
| ▲ | hxtk an hour ago | parent [-] | | It’s surprising to me how much people seem to want async in low level languages. Async is very nice in Go, but the reason I reach for a language like Zig is to explicitly control those things. I’m happily writing a Zig project right now using libxev as my io_uring abstraction. |
|
|
| ▲ | nesarkvechnep 2 hours ago | parent | prev | next [-] |
| I’m waiting for the kqueue implementation. |
|
| ▲ | khalic 3 hours ago | parent | prev | next [-] |
| Haven’t looked into MacOS internals for a while, happy to see they stuck to GCD, great middle ground for parallelisation |
|
| ▲ | tosh 5 hours ago | parent | prev [-] |
| > Both of these are based on userspace stack switching, sometimes called “fibers”, “stackful coroutines”, or “green threads”. |