10 ms·
Zig – io_uring and Grand Central Dispatch std.Io implementations landed
- gethly 8mo ago[flagged]
- cloudhead 8mo agoCan you elaborate? Zig has a lot of traction already.
- pjmlp 8mo agoExcept for Tiger Beetle customers and the few ones using Bun, what traction?
- gethly 8mo agoI've read Bun is just a wrapper, not actual Zig implementation anyway. Also, making a financial database in beta language that constantly changes and breaks is "really smart".
- dmit 8mo agoA wrapper over what?? Bun includes the JavaScriptCore engine for JS evaluation, but it's so much more. As for financial database concerns, if you're serious about including a project like that in your system, you have thorough correctness and performance testing stages before you commit to it. And once it passes the hurdles, at that point what difference does it make if it's written in a beta language, or a bunch of shell scripts in a trench coat, or whatever.
- dtf 8mo agoYou can actually go and read the source yourself [1]. If Bun is "just a wrapper", then surely Node.js and Deno are too? [1] https://github.com/oven-sh/bun/tree/main/src https://github.com/oven-sh/bun/tree/main/src
- steeve 8mo agoZML
- tosh 8mo agoGhostty https://ghostty.org https://ghostty.org
- pjmlp 8mo agoAnother one to the list, however it hardly sounds like a killer application.
- pdpi 8mo agoGhostty.
- 6r17 8mo agoI feel like this is doomerism with high bias - i'm sorry but there is nothing founded here ; for all I know ; if Zig is able to put only one good reason to be used - some people will use it and not care - however this is a purely logical statement and I do not know of Zig so I might be blind here.
- BonusPlay 8mo agoInstead of debating for years (like other languages), zig just tries things out. Worst case you can always rollback changes. IMO best APIs and designs are those that are battle tested by end users, not won in an argument war during committee meetings. This makes zig unique. It's fun to use and it stays fresh. You can always just stay on older version of zig. But if you choose to update to newer version, you get new tools to make your code tidier/faster.
- interstice 8mo agoThis is my favourite way to iterate, but the hard lesson is at some point after trying a bunch of things comes the Big Cleanup (tm). Is that a potential issue for this with Zig?
- SSLy 8mo ago0.16's IO API changes might be that cleanup.
- BonusPlay 8mo agoFrom my perspective zig doesn't have "big cleanup" upfront. It's removing older features as it goes. stdlib changes as it wants from version to version. So do language features. Since zig is pre-1.0, zig foundation isn't scared of breaking changes.
- Ygg2 8mo ago> Instead of debating for years (like other languages), zig just tries things out. So did Rust pre-1.0 Stability guarantees are a pain in the neck. You can't just break other people's code willy nilly. > This makes zig unique. It's fun to use and it stays fresh. You mean like how Rust tried green threads pre-1.0? Rust gave up this one up because it made runtime too unwieldy for embedded devices.
- alexrp 8mo agoJust on this point: > You mean like how Rust tried green threads pre-1.0? Rust gave up this one up because it made runtime too unwieldy for embedded devices. The idea with making std.Io an interface is that we're not forcing you into using green threads - or OS threads for that matter. You can (and should) bring your own std.Io implementation for embedded targets if you need standard I/O.
- small_model 8mo agoThere are high profile apps written in Zig, Bun (bought by Anthropic) and Ghostty also Uber use it. What apps are written in Jai or Odin.
- stock_toaster 8mo agoodin - jangafx’s embergen[1] jai - thekla’s new game, announced but not yet released —- order of the sinking star[2] [1]: https://jangafx.com/software/embergen https://jangafx.com/software/embergen [2]: https://en.wikipedia.org/wiki/Order_of_the_Sinking_Star https://en.wikipedia.org/wiki/Order_of_the_Sinking_Star
- Pay08 8mo agoThat's next to nothing for Jai.
- norman784 8mo agoI have my doubts on Jai, besides being built towards game development, from what I read/watched about it, it has 2 or 3 meta programming capabilities, like comptime, macros, etc it feels too much of the same, also Jai is not built towards correctness or safety, John mentality is that he knows what he is doing, so he doesn’t need those guardrails and he wants instead expressiveness. Also Jai is like C++ in complexity, while Zig is similar to C, very simple language. Carbon is vaporware so far, there’s no language that could be used yet, because they first need to solve the C++ interop and fast compilation times, that is what will shape the language, so no one is using it, because it doesn’t exist yet.
- ofalkaed 8mo ago>Also Jai is like C++ in complexity, while Zig is similar to C, very simple language. And most importantly, Zig is aiming at being a C++ replacement with the simplicity of C, it is not trying to replace C.
- pjmlp 8mo agoGood luck with that, it is basically Modula-2 with C like syntax, and we aren't even getting into the whole ecosystem that it is missing on. Any C++ or C replacement will need to win the earths of mainstream OS and game console vendors, otherwise it will remain yet another wannabe candidate. Those have already their own languages, alongside their own C and C++ compilers, and are only now starting to warm up to Rust. Zig or any other candidate will have a very hard time being considered.
- ofalkaed 8mo agoSo no one should even try because they will never win over all of the C/C++ crowd so are doomed to fail and forever to be a wannabe? I think Andrew has gone about things in a good way, going back to C and exploiting hindsight, not trying to offer everything as quickly as possible. Extend C but keep C interoperability and do both better than C++ instead of trying to be the next big thing and he goes about it in a very deliberate and calculated way. He may not succeed, but the effort has given us a great deal.
- xeonmc 8mo agoWalterBright reply in 3...2...1...
- WJW 8mo agoKinda weird to blame Zig for not being at 1.0 yet while Jai is still in closed beta after 11 years. Meanwhile Zig is being in used in big-ish projects all over while Jai has... a single game engine? Jai looks cool but it's far far FAR behind and losing ground.
- pjmlp 8mo agoThe fallacy of that argument would be if its author would seek adoption, however like Naughty Dog with their Lisp based language, John has no plans to have Jai win world adoption beyone his game engine.
- WJW 8mo agoThat may be, but OP tried to claim that > once Jai comes out, Zig will become obsolete If Jai is happy to have limited adoption (which is fine), other languages will by definition not be displaced by Jai. That is even if we accept OPs implied point, that Jai is good enough to displace Zig, without further discussion. But even that seems to be rather doubtful.
- pjmlp 8mo agoAgreed, however I also think Zig will be another Coffee Script, PureScript, Elm,... I advise to revisit HN posts about them.
- gethly 8mo agoSure, but Zig has way more money and people working on it. And Jai has inspired all of these new languages so all they had to do was to steal John's ideas whereas he had to actually think very hard about them and do countless iterations to come to a solid conclusion. He paid the cost, they reaped the benefits. So Zig being 10 years old and unfinished just shows they have no original thought, or a plan for that matter.
- ofalkaed 8mo agoBeing at 0.16 right now does not mean much. From what I gather, he is more focused on the semantics right now and trying to avoid getting bitten by a lack of foresight down the road, as most every language is. Things will probably start moving more quickly as the language solidifies.
- Ygg2 8mo agoAny backwards compatible language will accumulate hindsight errors. It's practically inevitable.
- deleted 8mo ago[deleted]
- gigatexal 8mo agoLet it come out before we get to chest beating. We are talking about shipped features in Zig here.
- dmit 8mo ago> Jokes aside Ok ok, good > once Jai comes out Dangit! You couldn't even make it to the end of the sentence.
- jpnc 8mo agoYou're right that zig is vaporware - not because of other languages - but because programming is going away entirely.
- ivanjermakov 8mo agoWhen in comes to programmming languages, I would rather see a language done right after 20 years of development than what we see today with all mainstream languages splatting features and breaking changes without care for overall language conciesness and usability. See Python 2->3, Rust async traits, Go generics, C++... basically everything.
- tosh 8mo ago> Both of these are based on userspace stack switching, sometimes called “fibers”, “stackful coroutines”, or “green threads”.
- deleted 8mo ago[deleted]
- khalic 8mo agoHaven’t looked into MacOS internals for a while, happy to see they stuck to GCD, great middle ground for parallelisation
- BrouteMinou 8mo agoI 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.
- pygy_ 8mo agoI 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.
- warent 8mo agoFor what it's worth, Bun is written in Zig (https://bun.sh/ https://bun.sh/). The language isn't exactly in an early stage.
- jauntywundrkind 8mo agoContrary 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 8mo agoIt’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.
- melodyogonna 8mo agoBut Zig's async is being designed to enable this low-level control.
- pjmlp 8mo agoUsing async in low level languages goes all the way back to the 1960's, became common in systems languages like Solo Pascal, Modula-2, with Dr.Dobbs and The C/C++ User's Journal having plenty of articles regarding C extensions for similar purposes. Hardly anything radical.
- hxtk 8mo agoWhen I look at historical cases, it seems different from a case today. If I’m a programmer in the 60s wanting async in my “low level language,” what I actually want is to make some of the highest level languages available at the time even more high level in their IO abstractions. As I understand it, C was a high-level language when it was invented, as opposed to assembly with macros. People wanting to add async were extending the state of the art for high level abstraction. A language doing it today is doing it in the context of an ecosystem where even higher level languages exist and they have made the choice to target a lower level of abstraction.
- lukaslalinsky 8mo agoI 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 8mo agoThey 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.
- lukaslalinsky 8mo agoIt doesn't say "minor" details like networking not being implemented :)
- hu3 8mo agoThey probably probably thought that this warning was clear enough: "should be considered experimental because there is important followup work to be done" I guess not clear enough to some people.
- audunw 8mo agoI think another way of thinking about this interface is: it’s kind of like an abstraction over Linux system calls and ntdll. It’s naturally gonna have a kind of subset of all the useful calls, with some wrapping. I don’t see anything wrong with this, it’s kind of how Windows forces developers to use DLL to access syscalls (the syscall numbers can change) which IMO is a good architectural decision.
- lukaslalinsky 8mo ago
- nesarkvechnep 8mo agoI’m waiting for the kqueue implementation.
- deleted 8mo ago[deleted]
- small_model 8mo agoI 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.
- cies 8mo agoI 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 8mo ago> 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 8mo agoUsing 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.
- Cloudef 8mo agoI like that zig takes freestanding target seriously. And seems like 0.16 becomes even better for freestanding code reusability.
- up2isomorphism 8mo agoWhen a language starts to do this kind of thing, you know it isn’t going to replace C.
- srcreigh 8mo agoThere's a relevant open issue[1] here about stack memory optimization. It would be nice to be able to use a [500]u8 in a block and another [500]u8 in another block, and have that only contribute 500 bytes to the stack frame, but Zig can't currently do this. (The green threads coro stack stuff makes this more important.) [1]: https://github.com/ziglang/zig/issues/23475#issuecomment-2795855793 https://github.com/ziglang/zig/issues/23475#issuecomment-279...
- portly 8mo agoAs always with Zig posts, here come the haters. I really wonder why you even care about it. Can't we all be happy that Andrew and his team are doing their damnest to create something they believe in? Myself I am deeply inspired by their engineering spirit. In other posts I see people "worry" that Zig might not become mainstream. Why do people worry about these things? Just use the language if it helps you solve your problems. You don't need to treat it like an identity.
- derefr 8mo agoA mainstream language has predictable library-ecosystem support for most use-cases.
- hu3 8mo agoIt's not v1.0 and they don't claim to be. So what is your point?
- derefr 8mo agoI was directly answering the GP poster's posed question. Let me rearrange that question for readability: > Why do people "worry" about Zig potentially never becoming mainstream? There are people who want to learn Zig because they're excited to gradually transition their way away from some other ecosystem, and into the Zig ecosystem, as the Zig ecosystem takes root and develops. But they don't want to regret that decision. They don't want to end up in a place where they're writing blog posts about how much they love Zig, and are the maintainer of five popular Zig libraries, and yet still feel forced to use C++ for their next actual app project (where they're then mostly unable to make use of those Zig libraries!) just because Zig, not being sufficiently "mainstream", can't attract/force the corporate owners of big fat libraries (Vulkan, CUDA, LLVM, etc) to invest effort into integrating with it, and continuously maintaining those integrations for it (i.e. including a Zig build in their CI matrix, so that their upstream changes can't silently break that integration.)
- beAbU 8mo agoA language, and by definition it's libraries, does not have to solve most use cases.
- Seattle3503 8mo agoIt's interesting to see this land while Rust support of io_uring in a mainstream library is lagging. And not for lack of trying, its just difficult to design a safe (zero-cost) idiomatic Rust abstraction over io_uring's completion based IO.
- pjmlp 8mo agoDoesn't look like this is done either, > 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:
- Seattle3503 8mo agoFair enough
- bastawhiz 8mo agoI'm not a zig fan myself, but I'm glad to see a substantial project with momentum and vision moving ahead. It's not languishing. It's trying interesting new things. It's striving for incremental gains consistently over time. There's a lot of hate in these comments. Nobody is forcing you to use Zig and it's not trying to be "done" right now. And in fact, if the only thing they were focusing on was putting a bow on the project to call it "1.0", it probably wouldn't achieve any of it's long term goals of being a mainstream systems programming language. If it takes another five years or fifteen, as long as the project moves forward with the same energy, it's going to be fine. For a fairly small project that's largely one dude, this is far more than most of us have or could hope to ever achieve ourselves. Give the people putting in the work credit where credit is due.
- allthetime 8mo agoEvery once in a while I build a game engine with a tcp & udp multiplayer server to learn a new language. I started doing this with zig a couple months ago. It might be because I've done it a few times now, and/or because of the existence of LLMs, but this is the most fun I've had doing, and the most productive I've been, and the engine absolutely rips performance wise. Zig makes it very easy to do this kind of lowish-level data-oriented programming, and tbh, I'm hooked. I was using rust for my performance critical services but dancing around the strictness and verbosity of memory management in rust gives me nothing in comparison and just gets in my way. This is partially a skill issue, but life is short and I just want to make fast, well organized software that works.
- janlucien 8mo ago[dead]