by throwaway415415 · 7y ago · 0 comments
The language already uses them for Arrays, Maps and Slices, plus a lot of code relies on runtime-typed ad-hoc generics with interface{}.
It's not as if Go is a language without warts... there's a lot of ugly stuff, like Iota, Reflection, the error handling, interface{} itself.
This is a legitimate question, btw. Legitimately looking for other points of view
They hear the golang authors complain about Java, that it's the only way to do things, so they think that the only other solution is to go the extreme opposite way, not even looking at real modern languages (which golang isn't) like Kotlin or even C# for instance.
It's very evident that the golang authors have no experience designing language, and didn't look in depth at what other languages did.
It is evident that Go is a better language than most thanks to the creators having deep experience in that domain.
Language abuse happens when the feature is the only available feature to implemented a particular and no other language feature allows for a better implementation.
in C++ most abuses of template are related to the missing feature "concepts". which took quite a while to get their.
If language switching is not an option, and your application requires generics and you are also required to use Go, you do have a problem. You need abuse the language and work around re-implement generics for Go.
Which can result in a very ugly development process, difficult to maintain code etc.
And nobody is advocating C++ style template metaprogramming. There are much better implementations of generics, as acknowledged by Russ Cox himself.