logoalt Hacker News

Refreeze5224last Tuesday at 4:58 PM9 repliesview on HN

I don't really understand this decision. They know from developer surveys that verbose and repetitive error handling is literally the number 1 issue. Seeking the perfection of syntax that everyone agrees on seems to be the enemy of providing some good alternative to the status quo.

Their comment about providing some new syntax and people being forced to use it seems off base to me. It's nice to not have multiple ways of doing things, but having only 2 when it comes to error handling does not seem like a big deal. I imagine people will just use their preference, and a large percentage of people will have a less verbose option if they want it.


Replies

munificentlast Tuesday at 5:07 PM

> They know from developer surveys that verbose and repetitive error handling is literally the number 1 issue.

Agreement on a problem does not imply agreement on a solution.

It's not about perfection. It's about not having a solution that gets anywhere near a majority approval.

Let's say your neighborhood has an empty plot of land owned by the city that is currently a pile of broken chunks of concrete, trash, and tangled wire. It's easy to imagine that there is unanimous agreement by everyone in the neighborhood that something better should be placed there.

But the parents want a playground, the pet owners want a dog park, the homeless advocates want a shelter, the nature lovers want a forest, etc. None of them will agree to spend their tax dollars on a solution that is useless to them, so no solution wins even though they all want the problem solved.

show 2 replies
arp242last Tuesday at 5:09 PM

> They know from developer surveys that verbose and repetitive error handling is literally the number 1 issue.

According to 13% of respondents. So yes, it's the "#1 issue", but also not by a huge overwhelming majority or anything.

show 1 reply
shadowgovtlast Tuesday at 5:17 PM

Python is a bit of a counter-example these days. I think they're in a good place right now, but it's hard to argue they've stuck to the premise of "There should be one-- and preferably only one --obvious way to do it."

- I need to do string interpolation: am I using f-strings or `string.format` or the modulo operator?

- I need to do something in a loop. Well, I can do that. But I could also just do a list or sequence comprehension... Or I could get fancy and combine the two!

And such and so-on, but these are the top examples.

Changing these things strictly adds cognitive load because you will eventually encounter libraries that use the other pattern if you're familiar with the one pattern. And at the limit of what this can do to a language, you get C++, where the spec exceeds the length of the Bible and many bits of it create undefined behavior when used together.

I think Go's project owners are very justifiably paranoid about the consequences of opening the Pandora's box on new features, even if it means users have to deal with some line-noise in the code.

neptharlast Tuesday at 5:39 PM

Yeah, this is the single biggest reason I avoid go - I just don't want to clutter my "happy path" logic. It makes things harder to reason about.

"Errors are values", sure. Numbers are values and Lists are values. I use them differently, though.

I wonder if there could be "stupid" preprocessing step where I could unclutter go code, where you'd make a new token like "?=", that got replaced before compile time. For instance, "x ?= function.call();" would expand to "x, err := function.call(); if (err != nil) return err;"

show 1 reply
teeraylast Tuesday at 5:37 PM

> ...having only 2 when it comes to error handling does not seem like a big deal. I imagine people will just use their preference...

I foresee endless PR arguments about whether err != nil is the best practice or whatever alternative exists. Back-and-forth based on preference, PRs getting blocked since someone is using the "other" style, etc. Finally the org is tired of all this arguing and demands everyone settle on the one true style (which doesn't exist), and forces everyone to use that style. That is where the "forced to use it" comes from.

From the early days, Go has taken principled stands on matters like this, striving for simplicity and one way to do something. For example, `go fmt` cut through all the tabs vs. space nonsense by edict. "Gofmt's style is no one's favorite, yet gofmt is everyone's favorite."

ignoramouslast Tuesday at 5:10 PM

> I don't really understand this decision.

The decision is disappointing, but understandable.

The blog post attempted to explain it, but it comes down to: A lot of energy has been expended without the community and the core team reaching any form of consensus. The current error handling mechanism has entrenched itself as idiomatic for a very long time now. And since the promising ones among the various proposals involve language changes, the core team, which is stretched already, isn't willing to commit to it at this time, especially given the impact.

show 1 reply
jiehonglast Tuesday at 6:01 PM

The language was first designed without consensus and then released. It was used anyways.

But now a sort of democracy is required for changes. I’m not sure this is necessary.

show 1 reply
yandrypozolast Tuesday at 5:24 PM

people that answer surveys don't represent all Go developers, many of us are fine with the error status quo

show 1 reply