Hacker News new | ask | show | jobs
by loosescrews 1259 days ago
> I don't want to spend my time learning the myriad quirks of a language.

That is just it. Go's quirks are mostly a result of its consistency, not a result of a lack of consistency.

> I assure you that just knowing "some basic concepts" is not enough to avoid Go's pitfalls and footguns.

It seems that Go has two somewhat contradictory goals: consistency and similarity to popular yet inconsistent languages. This seems to result in a lot of people who can generally use the language, but haven't learned the language model because the language doesn't require that in order to get started. This seems to frustrate a lot of people and prevent them from ever learning the language model. Languages which appear completely different from popular languages don't seem to suffer this issue because people tend to learn the language model up front.

Go really only has one major source of inconsistency and that is the late addition of type parameterization. The built-in parameterized types are special, but still generally follow the same rules as other types with a few exceptions. The main thing you need to know about slices, maps, and interfaces is what they actually are. Once you know that, the normal rules apply. Channels are a different beast though.

1 comments

How can you honestly claim that the language is consistent when it didn’t use to be able to express a map without supporting it on a language level (instead of only being a lib)? A properly consistent language would be one where you could reasonably come up with how to use anything, including such a basic data type just from simple primitives. Go is very far from that.

Have a look at the excellent “Growing a language” talk by Guy Steele where he goes into great detail on what would a truly consistent language entail.

"Being able to solve every programming problem" is not a necessary prerequisite for consistency. If that were true, SQL would be inconsistent because it cannot interface with libgl in order to render 3D graphics. That is clearly nonsense.
Was this comment meant for me?