Post AqaKZbbKmL5NZZOFMW by UkiahSmith@mastodon.social
 (DIR) More posts by UkiahSmith@mastodon.social
 (DIR) Post #AqaKZbbKmL5NZZOFMW by UkiahSmith@mastodon.social
       2025-01-29T16:31:43Z
       
       0 likes, 0 repeats
       
       There was discussion about reducing the boilerplate of error handling for #Golang. I really did not like the options that were offered. They were confusing and limited in scope. I am happy to say that the proposal is not planned, and the issue is closed. I am pleased that the discussion took place, and that the Go community was able to look at options for improving the language overall.https://github.com/golang/go/issues/71203
       
 (DIR) Post #AqaKZcmMOpV3E3YZBg by hisham_hm@mastodon.social
       2025-01-29T19:39:02Z
       
       0 likes, 0 repeats
       
       @UkiahSmith Lua "suffers" from the same "if err then return nil, err end" boilerplate problem as Go, and I've been thinking a lot about that lately.Rust-like ? is a typical choice, with all pros and cons mentioned in this thread. Lua is more keywordy than symbolish, though, so I've been considering Zig's `try` as well.
       
 (DIR) Post #AqaKZdsmISEAeFZCpU by frosch@edolas.world
       2025-01-29T20:12:04.460812Z
       
       0 likes, 0 repeats
       
       @hisham_hm I like this explicit boilerplaty `if err then return nil, err end` in Lua, but even though I didn't wrote a single line in Zig I watched a couple of videos about it and I agree that Zig's `try` is also pretty nice.@UkiahSmith
       
 (DIR) Post #AqcJsvcqqCkLXdfZoG by UkiahSmith@mastodon.social
       2025-01-30T01:41:32Z
       
       1 likes, 0 repeats
       
       @frosch @hisham_hm I prefer the if err != nil boilerplate too. It's rather obvious, but I don't find it overly distracting. My non-scientific view is that most people who dislike it don't want to actually handle the errors to begin with. They just want to throw them up the call stack as if they were exceptions. My opinion is based on reading social media and blog posts.
       
 (DIR) Post #AqcK4MrvtL5NDjB8Fc by hisham_hm@mastodon.social
       2025-01-30T08:57:30Z
       
       1 likes, 0 repeats
       
       @UkiahSmith @frosch Count me along with the people who dislike handling errors. I do it 'cause it's necessary, not because I like it.My view is that `if err != nil { return nil, err }` is effectively throwing it up the stack and not really "handling" them in a meaningful way.My past experience with Java made me feel that unchecked (i.e. auto-thrown) exceptions are bad. But as long as the programmer needs to state some way at the failure point whether to handle or rethrow, that's good enough.