Hacker News new | past | comments | ask | show | jobs | submit login

The compiler infers the errors in an error set even if you don't declare it explicitly (e.g. when returning `!void`). This means that you can use a switch statement to have the compiler tell you what cases it contains.

There's also ZLS, a language server implementation for Zig that I believe can help with that (or if not today, it will in the future).




Cool trick, I did not know this, but it makes sense.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: