Hacker News new | ask | show | jobs
by throwawaymaths 502 days ago
if you need values associated with your error you can stash them in an in-out parameter
1 comments

If I have multiple errors then that in-out parameter has to be a union(enum). And then I'm back to creating dozens of slightly different unions for functions which return slightly different sets of errors. Which is the same problem I have in rust. All of the nice inference that zig does doesn't apply to my in-out parameter either. And the compiler won't check that every path that returns error.Foo always initializes error_info.Foo.
i dont think you can make a union that has an error enum tag. I dont see why the in-out has to be dependent on the error.