One and a half colors
One and a half colors
Posted Dec 2, 2025 18:53 UTC (Tue) by daroc (editor, #160859)In reply to: One and a half colors by smurf
Parent article: Zig's new plan for asynchronous programs
It's a bit different because the syntax of the functions involved doesn't change. And you can store an Io in a data structure or global variable if you want to. But I agree it's separately onerous to have another piece of context to port around everywhere.
As for managing the event loop: I believe the plan is for there to be built-in functions that can start executing a function on a user-provided stack, so the event loop can allocate separate stacks and then give them to the running functions. But Zig has also had a long-term goal to eventually be able to statically determine the needed stack size of any given function, at which point it should be possible to write comptime code that does better than that.
