Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> typing this repetitive (for a reason) pattern became not a problem at all

Code is read 10x more than it is written. The noise this pattern introduces inhibits reading and rapid comprehension.

Things are getting marginally better now that go has errors.Is and errors.As, and also now that go is starting to get some functional iterators. But go is one of the least quickly-understandable of the modern languages currently in use.





> The noise this pattern introduces

Here is the thing... it's NOT a 'noise'. Untill you see handling 'error path' as noise, you will be trapped in searching magic bullet language solution to hide it. We've all been there.


Handling errors doesn’t have to be noisy. Handling errors the way golang requires is.

When it takes five times as long to figure out how a function actually works (not only due to error handling, to be fair), the language has a problem.


Your last sentence makes sense only if you consider “happy path” to be what you call “understanding how function works”. A lot of programmers are annoyed that Go forces them to think about “error path” as equally important. Later many say that Go forces you to be the better programmer. But it takes time. In any case, saying “language has a problem” is a wrong frame for thinking about this design choice.

This is something gophers constantly repeat, but it is entirely a self-inflicted issue that other languages more modern than C don’t actually struggle with.

When in Rust, it is explicitly clear when and where errors can come up, and what types of errors I have to deal with. It is far less clear in golang, since there is no help from the type system when I’m using errors.Is and errors.As. Not being verbose doesn’t make error handling any less explicit.

Nobody is upset about having to pay attention to the unhappy path. This is entirely a straw man that gophers fall back to in order to feel like they’re somehow enlightened, shut down conversation, and to avoid having to consider what other people are saying. We are desperately hoping to help you realize that there are other, better ways that don’t come at the ridiculous readability costs inflicted by the anemic golang approach.

It really is okay to stop making excuses and accept that your preferred language has warts. I promise. Nobody will think less of you.


> other languages more modern than C

> When in Rust

A language newer than Go isn't just "more modern than C".


That's not a straw man, it's a valid reply to your first argument about "error handling code being an obstacle to understanding how function works". Why it makes you angry and makes you resort to ad hominem, I don't know, but that's clearly the end of the discussion.

No, it is a knee-jerk response that invariably assumes that a belief that golang’s specific approach is bad is equivalent to believing that errors are of secondary importance, and assumes that anyone who disagrees with the golang approach just doesn’t get how important it is to deal with errors.

You would rather dismiss other perspectives out of hand than actually reflect on how your chosen language might evolve.

In my perspective, this has been the entire historical progression of golang. Everyone vehemently denies that there’s a problem, eventually the language authors address it, and then everyone insists that it’s always been known that they needed to deal with the issue.

I don’t know why this seems to be so endemic to the golang community. Other languages’ adherents seem more than willing to accept the shortcomings of their preferred tools. But gophers continually insist that all the problems are actually strengths right up until it’s fixed and then they retcon their previous beliefs. It’s extremely off-putting.


The only knee-jerking here is this: "When it takes five times as long to figure out how a function actually works".

Don't be surprised by receiving low quality responses when you start off the discussion with ridiculous hyperboles and show poor understanding of the issue at hand.


> The noise this pattern introduces inhibits reading and rapid comprehension.

Nonsense. We don't read letters, nor even words, we see patterns. if err != nil {} is easy to skip over visually.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: