4 ms·
So is Go not a “new serious language”? You can definitely have nil pointers panic in Go if written poorly.
by jsjohnst 7y ago
So is Go not a “new serious language”? You can definitely have nil pointers panic in Go if written poorly.
- grapehut 7y agoGo is even worse. They just use the word "nil" instead of "null". Go does a lot of really silly things too, like the nil pointer receiver's (basically something that allow you dereference null in certain contexts) ends up having terrible side-effects on the type theory and you end up with really stupid exceptions, like nil represents an empty slice and you can do stuff like get it's size or append to it, but the same operations would cause a panic with a map. But both Java and Go are serious languages.
- tyingq 7y agoThere are certainly people that feel like it was a mistake. https://getstream.io/blog/fixing-the-billion-dollar-mistake-in-go-by-borrowing-from-rust/ https://getstream.io/blog/fixing-the-billion-dollar-mistake-...
- hu3 7y agoThere are only two kinds of languages: the ones people complain about and the ones nobody uses.
- deleted 7y ago[deleted]
- lilyball 7y agoGo having nil for various types is indeed a problem. In fact, a few weeks ago I caught an issue where a map in Go was unexpectedly nil when it should have been full of data (missing initializer), and I caught it because the serialized data was then consumed by the client written in Swift which doesn’t have this issue. Go thought it was writing data to spec but the client immediately diagnosed it as having an unexpected null before it even tried to work with the data.