1 point
*

I know this is a piece of humor, but half of these are not surprising coming from a FP background (expression oriented, sum types, strong generic typing… )

Also, daring to compare Go and Rust error handling, and saying that Go’s one is better is… bold. It’s arguably one of the worst in any language.

permalink
report
reply
1 point

Disclaimer: Rust is an awesome language, and this blog is meant purely for some fun and perhaps a bit of frustration!

Yeah, yeah, ok I get it. But please, please don’t use images for code samples!

permalink
report
reply
4 points

I went into this with an open mind, then I saw the rant about error handling and I closed the article immediately.

Rusts error handling in combination with eyre/anyhow is the most pleasant error handling I have used in any language. You know exactly which lines can return errors, you can very quickly propagate them and attach context so that you can quickly troubleshoot later on, and it’s completely natural and unintrusive. No figuring out whether you already logged the error somewhere else, no inconsistent handling of them, it’s one library that does everything for you and you never have to think about it.

The go example is comparatively awful. You are forced to handle the error at each stage, and it runs into the same problem as exceptions where you’re not really sure at which point you actually handled the error among other things.

permalink
report
reply
0 points

@gnus_migrate @nebiros In Go we consider errors as values and not fatal or exceptions. For example sql.ErrNoRows , io.EOF, custom… It’s why they are returned and used like any other values.

permalink
report
parent
reply
2 points

The difference is that you can’t have a generic mechanism in Go for error handling. It’s basically up to the programmer, and every if error != nil line is a potential source of bugs.

permalink
report
parent
reply
2 points

Errors are values in rust too. There are a couple of differences, like the ? syntax, rust returning a value or an error instead of a value and an error (or nil) for example, but everything you wrote applies to rust as well.

permalink
report
parent
reply
5 points

This is just a rant about personal frustrations. I even probably agree with him on most of these things, but I don’t think we need to share this kind of thing here. So tired of threads about how much we all hate and disagree with each other’s languages. It’s better if the rust people get rust and the go people get go. There is no one holy grail of a language that everyone is going to like.

permalink
report
reply
1 point

Now I kind of want to make a Holy Grail language. Probably Monty Python themed, and you have to do a lot of nonsense to make anything work.

permalink
report
parent
reply
1 point

This only made me dislike go more

permalink
report
reply

Golang

!golang@programming.dev

Create post

This is a community dedicated to the go programming language.

Useful Links:

Rules:

  • Posts must be relevant to Go
  • No NSFW content
  • No hate speech, bigotry, etc
  • Try to keep discussions on topic
  • No spam of tools/companies/advertisements
  • It’s OK to post your own stuff part of the time, but the primary use of the community should not be self-promotion.

Community stats

  • 29

    Monthly active users

  • 151

    Posts

  • 243

    Comments