Zig 0.16.0 Release Notes

106 points by vpol


kneeawn

The 'Juicy Main' bit is interesting. I don't think I've seen this approach taken to this level. I know that in C/C++ you can optionally have argc and argv (apparently envp is implementation defined) and in Austral, you can optionally have a RootCapability. Are there other examples of this (besides languages doing the C/C++ thing)?

badtuple

Congratulations on the release!

Super excited to kick the tires on std.Io. Even ignoring sexier justifications around function coloring and swappable concurrency models, injecting IO just feels like the right way to do things. Isolating effects isn't just for the functional peeps ;) . It enables so many ergonomic debugging and testing capabilities. Not having to awkwardly stub out IO-using dependencies for tests is going to be so nice for larger projects that need to ensure correctness.

"Juicy main" is a huge quality of life improvement. Avoiding the allocator setup preamble for quick programs is great. It was just a few lines, but was just enough friction to be annoying. I expect more than a few past-newcomers bounced off there before really trying the language.

Was surprised to see the "Forbid Trivial Local Address Returned from Functions" section. I didn't realize that was in the works. It hides a link to planned work to error on returned local references too! I don't think I've run into these issues in years, but I definitely did when starting out with manual memory management. That should go a long way for anyone hesitant about Zig's safety story.

technetium

The integer and float casting improvements are all very neat:

Things like this were always a pain in the neck for me, since my main Zig project is a little roguelike. I'm sure it's not what folks think of when you say "game development" (I'd call it "lite game development" instead), but it helps all the same! Can't wait to see what other ergonomic improvements make it out.

I'm also happy to see the Future type and general async being added to the language again, even if it's only in the standard library. In the past I (ab)used async to produce generators, which I used heavily for things like animations and such. Those animations became 1.5-2x code when I had to convert them to a state machine, so I look forward to seeing if the new async system is capable of the same thing.

environment variables are available only in the application's main function.

I recall that glibc has a nonstandard extension where, if a certain symbol is defined, glibc calls the symbol with a copy of the environment map and thus allows dynamic and shared libraries to access the environment without being passed a copy. Would this be considered as a Linux-only alternative?