the.bay.news

Inferred error set without an error union

Ziggit
Inferred error set without an error union
If a function returns an error union, Zig can infer the error set automatically. Does this also somehow work for functions that don’t return error unions, but just errors? For example, is there a way to avoid having to explicitly specify the error{ A, B } error set here? fn mapError(x: i32) error{ A, B } { return if (x > 0) error.A else error.B; }

0 comments

Sign in to join the discussion — your thebay.events account works here.

No comments yet.