r/ProgrammerHumor • • Oct 24 '26

Meme dreamLanguage

Post image
1.4k Upvotes

211 comments sorted by

View all comments

66

u/coldnitrogen Oct 24 '26

Go error handling isn't bad. I'd actually prefer it to Try-Catch blocks

29

u/spigotface Oct 24 '26

I actually love Rust's error handling. It's definitely more verbose than other languages', but handling it as an enum, including it in the signature, AND having the compiler force you to handle these things is perfect. If things can fail, you should be forced to handle it.

7

u/Familiar_Ad_8919 Oct 24 '26

rust's sophisticated error handling when: .unwrap(), maybe even: .expect("thingy go bad")

jokes aside, i love it, when errors do get thrown without being handled it could be a bit clearer as to what went wrong but its just nitpicking at that point, its vastly better than spamming try catch

8

u/ICantBelieveItsNotEC Oct 25 '26

Honestly, I think adding unwrap() and expect() was the biggest mistake Rust ever made. Panicking on an error should not be that easy. A ton of new Rust devs treat unwrap() as an incantation that makes the code compile, and they completely bounce off of the beautiful error handling system as a result.

10

u/PM_ME_YOUR_REPO Oct 24 '26

I love Go error handling.

35

u/UdPropheticCatgirl Oct 24 '26

I mean, I would prefer leprosy to cancer, doesn’t change the fact that both are miserable.

23

u/ddarrko Oct 24 '26

It’s great for forcing you to handle errors and in my experience leads to less bugs.

6

u/UdPropheticCatgirl Oct 24 '26

Sure... so does Java with checked exceptions...

The entire problem is with how much line noise this pollutes your codebase with...

5 out of 9 different languages in the original post force you to handle errors, but Go (and occasionally Java) is unique in it's verbosity, it produces enough ceremony for people to complain about it.

12

u/ddarrko Oct 24 '26

Personally I find throwing exceptions and expecting callers to handle more problematic.

Theoretically you can ignore err returns in Go but it forces you to think about most possibilities up front. Agreed it is verbose but as I used the language more I found it more of a blessing.

Everyone is entitled to differing opinions though.

-2

u/SuitableDragonfly Oct 24 '26

If you want to ignore a returned err in Go, you have to specifically name it _, otherwise the compiler will yell at you for not using the variable. There are some cases where you could miss an error if you are using the same variable name for a long series of errors and checking each of them, but in general I also think it's a good system. 

8

u/ddarrko Oct 24 '26

I just said that ^ …

0

u/SuitableDragonfly Oct 24 '26

Yes, I was just adding to what you said. 

4

u/Batman_AoD Oct 24 '26

It's much better than C++ exceptions, yes. 

1

u/Integeritis Oct 24 '26

I raise you Swift error handling

1

u/dhilzyi Oct 25 '26

More work for sure, but I love error handling in go

1

u/Aidan_Welch Oct 25 '26

No its not, what is bad is the type system/comptime templating.

1

u/aabil11 Oct 27 '26

It's deliberately old school C-style. Back when we had to check return values

-3

u/Crandom Oct 24 '26

Go error handling hurts my soul