←back to thread

Go subtleties

(harrisoncramer.me)
235 points darccio | 3 comments | | HN request time: 1.34s | source
Show context
rowanseymour ◴[] No.45666258[source]
Ah the old nil values boxed into non-nil interfaces. Even after 8 years writing go code almost every day this still bites me occasionally. I've never seen code that actually uses this. I understand why it is the way it is but I hate it.
replies(4): >>45666614 #>>45666792 #>>45666859 #>>45669163 #
amelius ◴[] No.45666614[source]
I ditched Go after an evaluation years ago. I can remember it was an issue with nil pointers being non-intuitive that turned me off. And exception handling. A pity because the runtime and ecosystem/community seemed pretty good.
replies(2): >>45666666 #>>45667034 #
rowanseymour ◴[] No.45666666[source]
It's fantastic concise language and standard library steered by people who are determined to keep it simple and intuitive... which IMO makes it all the more odd that it has this obvious foot gun trap where `!= nil` doesn't always mean what you might think.
replies(1): >>45667163 #
amw-zero ◴[] No.45667163[source]
The “simplicity” of Go is just virtue signaling. It has gotchas like that all over the language, because it’s not actually simple.
replies(3): >>45667506 #>>45669557 #>>45673702 #
1. LandR ◴[] No.45667506[source]
Yep.

The lack of features means all the complexity is offloaded to the programmer. Where other languages can take some of the complexity burden off the programmer.

Go isn't simple, it's basic.

replies(1): >>45667557 #
2. amelius ◴[] No.45667557[source]
Perhaps Go is a nice target language for a transpiler, so you could still benefit from the runtime and ecosystem while fixing the bugs in the language itself. Anyone working on this?
replies(1): >>45669862 #
3. bobbylarrybobby ◴[] No.45669862[source]
https://github.com/borgo-lang/borgo