Live data from Hacker News

Go Rocks - How Can We Avoid Something This Bad In The Future?

acooke.org

1–10 of 68 posts

Re: Go Rocks - How Can We Avoid Something This Bad In The Future?

#4
I wrote a bunch of go code this morning. It's definitely got a few really neat ideas in it.

I tend to write erlang or c++ mostly for my day job. I do really wish the designers had a bit more erlang experience. Just a touch. Just enough so that I had a way to propagate the death of a goroutine through a bunch of other goroutines without building all of that manually.

For example, code I wrote today:

http://pastebin.com/Zp6eqqTa

That infinite loop is really infinite. If the goroutine feeding the channel dies (e.g. if the connection is dropped), this thing will keep reading on the channel. In erlango, I'd do something like "go_link client.Feed(ch)" and the right thing would happen. Here, I really need to spin up a second channel to send out the death spurt, select across the channels in my loop and send my death message with defer.

defer is awesome, and I wish every language had it (C++ has something that looks like it if you write enough code and squint hard enough). Still, I've got a lot of code like the above and I imagine it's not an uncommon thing.

Every language has something that just feels unjustifiably wrong with it, though. go certainly isn't one I'd be pained to use if I had to every day.

(Edit: couldn't figure out code formatting, tossed it over to pastebin)

Re: Go Rocks - How Can We Avoid Something This Bad In The Future?

#5
I still think the major stumbling block for Go is the syntax. I can't put my finger on it, but from the first time I saw it I thought it looked wrong.

Can anyone who shares my opinion chime in on what things they think cause the syntax to suffer aesthetically?

Re: Go Rocks - How Can We Avoid Something This Bad In The Future?

#6

I still think the major stumbling block for Go is the syntax. I can't put my finger on it, but from the first time I saw it I thought it looked wrong. Can anyone who shares my opinion chime in on what things they think cause the syntax to suffer aesthetically?

It's the mix of old-school brace syntax, with the omitted parens which makes it look off to me.

Re: Go Rocks - How Can We Avoid Something This Bad In The Future?

#7
post #4

I wrote a bunch of go code this morning. It's definitely got a few really neat ideas in it. I tend to write erlang or c++ mostly for my day job. I do really wish the designers had a bit more erlang experience. Just a touch. Just enough so that I had a way to propagate the death of a goroutine through a bunch of other goroutines without building all of that manually. For example, code I wrote today: http://pastebin.co…

If you modify your for loop to range over ch, you can make the sending side close(ch) when an error occurs, and then the loop will end and the receiver can shut itself down.

http://pastebin.com/FMSLvFCn

Re: Go Rocks - How Can We Avoid Something This Bad In The Future?

#8

I still think the major stumbling block for Go is the syntax. I can't put my finger on it, but from the first time I saw it I thought it looked wrong. Can anyone who shares my opinion chime in on what things they think cause the syntax to suffer aesthetically?

I'm amazed by this particular criticism of Go. Compared to many modern languages (Erlang or Ruby, for example), Go's syntax is barely different to Java or C. But I think it's better than either of those (It's certainly more regular).

Try it for two days and you'll change your mind.

Also, see: http://blog.golang.org/2010/07/gos-declaration-syntax.html

Re: Go Rocks - How Can We Avoid Something This Bad In The Future?

#9
post #8

I still think the major stumbling block for Go is the syntax. I can't put my finger on it, but from the first time I saw it I thought it looked wrong. Can anyone who shares my opinion chime in on what things they think cause the syntax to suffer aesthetically?

I'm amazed by this particular criticism of Go. Compared to many modern languages (Erlang or Ruby, for example), Go's syntax is barely different to Java or C. But I think it's better than either of those (It's certainly more regular). Try it for two days and you'll change your mind. Also, see: http://blog.golang.org/2010/07/gos-declaration-syntax.html

The trouble is that it borrows a lot from C and then subtly changes it for no discernible reason. This is especially true with variable declaration.

Go is the only language I've ever tried for a while and been really put off by the syntax. I can't quite articulate why either. It's not...pretty. I write quite a lot of C++ and Python, so theoretically I should be a pretty good fit for Go. But it doesn't click with me.

Re: Go Rocks - How Can We Avoid Something This Bad In The Future?

#10
post #9
post #8

Earlier quoted context omitted.

I'm amazed by this particular criticism of Go. Compared to many modern languages (Erlang or Ruby, for example), Go's syntax is barely different to Java or C. But I think it's better than either of those (It's certainly more regular). Try it for two days and you'll change your mind. Also, see: http://blog.golang.org/2010/07/gos-declaration-syntax.html

The trouble is that it borrows a lot from C and then subtly changes it for no discernible reason. This is especially true with variable declaration. Go is the only language I've ever tried for a while and been really put off by the syntax. I can't quite articulate why either. It's not...pretty. I write quite a lot of C++ and Python, so theoretically I should be a pretty good fit for Go. But it doesn't click with me.

There are good reasons. See the blog post I linked to.
Post reply on HN