4 ms·
if you need values associated with your error you can stash them in an in-out parameter
by throwawaymaths 2y ago
if you need values associated with your error you can stash them in an in-out parameter
- jamii 2y agoIf 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.
- throwawaymaths 2y agoi 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.