|
|
|
|
|
by Cloudef
408 days ago
|
|
You would have to give up on global error set with sum types, unless you want to see the global error set bloat with the largest sum type. Also if the error payload needs allocating what are you gonna do? Allocating is no no no here. I know rust will just panic in OOM but zig chooses not to do that. Even if you allocated, since zig has no borrow checker the error handling becomes nightmare as you now have to deal with freeing the potential allocations. Using out parameters for context, or diagnostic pattern like std does is not bad at all imo. The only nice thing error payloads give you is better error messages in case of uncaught errors. |
|