Settings

Theme

Err = Nil Sucks (Or Does It)

youtube.com

2 points by random_mutex 2 years ago · 2 comments

Reader

ColonelPhantom 2 years ago

This feels a bit strawmanny. "If you're doing err=nil in typescript, it sucks worse than Go!" Yeah, but nobody does err=nil in typescript, you just re-throw or something similar. At least that's what happens in Python land, which I'm more familiar with and also uses exceptions for error handling.

I also think most of the criticism of Go error handling is that it's a clunky and noisy implementation of the "error values" idea. Rust does the same, but instead of a (value, error) tuple they use enums that clearly discriminate between the two, and aren't afraid of providing more concise syntax for the common 're-throw' case.

  • random_mutexOP 2 years ago

    In TypeScript or Python or any other language with unchecked exceptions you will rethrow and very likely the exception will be caught by te runtime when you least expect because someone else didn't bother handling it.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection