Hacker News new | ask | show | jobs
by corethree 952 days ago
No it's not. It's not java programmers who are wrong, it's you and golang that is wrong. You clearly don't know what you're talking about. I hate smug golang programmers who think they're gods gift to programming because they think they're so good at go when they don't realize how broken go is as a modern language. Honestly it's only the golang programmers who have this attitude.

Golang (and java) by nature has a bad type system that's fundamentally incompatible with popular data structures used in the web.

Json a very popular web data structure cannot be represented properly as a type in golang.

The standard way of dealing with a dynamic json data structure in golang is to resort to interfaces and type assertions or assuming it's some struct. There is a similar problem in java. This isn't some "wrong" thing in go as you wrongly state. It's standard practice. You are suppose to use interfaces for this purpose in go. It's standard and by design. If you haven't then you haven't worked on something sufficiently big enough such that the input parameters include json of an unknown structure. Basically you only worked in web apps where inputs aren't complex like trees which is a valid structure that can be represented in json.

Rust gets around this by something called sum types allowing you to stay type safe without ever resorting to breaking out of the type system when dealing with any json type. Typed python also has sum types which let's you easily get around this problem.