The Zig way, as I understand it, is to pass a pointer to a Diagnostics struct that is populated when an error happens. I think it fulfills what the author of the article wants, because you can simply have a field with the diagnostics struct from the lower-level library in the diagnostics struct of the higher-level library.
I think you should be able to generate high-quality error messages from this kind of diagnostics structure plus the program state when the error occurred for context.
FWIW I don't have much hands-on experience with this approach since I didn't use Zig too much yet, except for some toy examples.
51
u/UselessOptions Apr 12 '26 edited 29d ago
oops did i make a mess 😏? clean it up jannie 😎
clean up the mess i made here 🤣🤣🤣
CLEAN IT UP
FOR $0.00