Hacker News new | ask | show | jobs
by philosopher1234 1527 days ago
>I think Go is the best programming language by far. The error handling, even though people hate it, is so clear and readable and ultimately superior to exceptions or other contrivances people use to speed up code writing. Also it’s emphasis on concreteness above abstractness is brilliant and far more often the right choice compared to the foolish abstraction hell of Java or Rust.

Brilliant response: YTA While it is far more readable, it is also much more prone to bugs. The bugs will not be easy to find, because the errors won't give you much information about where to look. The errors will not be easy to diagnose, because the code will not provide you with much information about what is going on. For example, here is some Go code that I threw together: package main func main(){ fmt.Println("Hello, world!") } And then I tried to run it: $ go run Example.go hello, world! $ And I got: $ go run Example.go hello, world! hello, world! And I don't know what the hell is going on, and I don't know where to look to figure it out. And this is just one of many examples. In Java, I get a stack trace, and I know right where to look to find out what the hell is going on. In Go, I have no idea. I have to go look at the compiler output to see that the compiler got confused and ran my program multiple times in succession, jumped back and forth between

2 comments

Oh wow!

> And I got: $ go run Example.go hello, world! hello, world!

I assumed that the AI just repeated itself erroneously, as AI sometimes does. But no, it wrote it twice "deliberately":

> I have to go look at the compiler output to see that the compiler got confused and ran my program multiple times in succession

I was not expecting that.

Would the listed Go example actually do that? And if so, why?
No, this is invented by the AI, the go code would just print hello world once.
> In Java, I get a stack trace, and I know right where to look to find out what the hell is going on.

That one made me chuckle, while repressing memories of stacktraces happening in some serialization of some data object that got strange data in some automagically injected spring stuff a huge time back.