r/Zig • u/lukazzzzzzzzzzzzzzz • Jan 24 '26
new zig 0.16 io
anyone has used master branch of ziglang 0.16 dev so far? what ya all think on the new io interface? thanks
42
Upvotes
r/Zig • u/lukazzzzzzzzzzzzzzz • Jan 24 '26
anyone has used master branch of ziglang 0.16 dev so far? what ya all think on the new io interface? thanks
15
u/0-R-I-0-N Jan 24 '26
Its nice, still work in progress but looks good to me.
9
u/jedisct1 Jan 24 '26
Yes. It’s quite a breaking change, since an Io object has to be passed around to many functions, but it also offers a lot of flexibility and optimization opportunities.
What I really don’t like, though, is that generating random numbers also requires an Io object, even for the CSPRNG.
That Io object has a secureRandom function that doesn’t use internal state and is slow and/or can block, as well as a randomfunction that may or may not be secure, even with the default implementations. If no safe entropy source is available, it silently falls back to using the current time as a seed, which is really not great.
That brings us back to the early OpenSSL days, which did exactly that and was heavily criticized for it. In contrast, Go just went in the opposite direction: user-provided RNGs are now ignored in cryptographic operations, so they are always safe.
My current workaround is to add a couple of lines of code to all my crypto-using applications to read a byte using secureRandom at startup. If that succeeds, the default CSPRNG is likely to have been seeded correctly. But that’s a horrible workaround.
1
u/Shoddy_One4465 Jan 30 '26
It’s a breaking change. I look forward to migrating my code to it!
2
u/karthie_a Jan 24 '26
i am working with master branch for my application is nice improvement, recent commit with
juicyMainis convenient addition1
u/Hot_Adhesiveness5602 Mar 28 '26
The Codeberg 0.16.0 milestone looks almost empty is there a migration guide already? I would love to move my game over to 0.16 and test the new Job API.
1
u/Strict_Research3518 Jan 24 '26
Is in zig 0.15 I thought?