Hacker News

Favorites Setup
Comment by jazzypants | original | A NES emulator written in Odin
[−]jazzypants · 2026-11-15 Sun 16:35 UTC · link
> - go style err!=nill style exception handling

Is this not widely considered to be the ugliest part of the language? Why do you prefer having to do this manually?

[−]ixwt · 2026-11-15 Sun 16:40 UTC · link
It is, which is why the or_return[1] keyword was created.

[1]: https://odin-lang.org/docs/overview/#or_return-operator

[−]iaaan · 2026-11-15 Sun 18:05 UTC · link
As someone who is primarily a Go dev, I never understood this criticism and have never seen a language do it any better (but I'm open to suggestions). I think try/catch is worse. I kinda like JS's promise syntax with the `.then()` and `.catch()`, but it doesn't appear that different to Go's approach.
[−]vips7L · 2026-11-15 Sun 18:45 UTC · link
Personally I think Go style is worse, because the runtime and compiler don't force you to handle the error. I just had to fix a critical issue because a dev forgot to check the result coming from a function, exceptions would have forced it to happen.
[−]wolttam · 2026-11-15 Sun 18:27 UTC · link
Errors as values instead of some special language construct is generally a nice thing (IMO)
[−]vips7L · 2026-11-15 Sun 18:31 UTC · link
Exceptions are values. There's nothing different between:

    T someFn() throws E;
    fn someFn() -> Result<T, E>;
    func someFn() (T, E)
[−]Dr_Emann · 2026-11-15 Sun 19:09 UTC · link
In only one of those examples do you get a T that's invalid.