3 ms·
As a Go developer, I rarely ever miss generics. If you design up front with interfaces and the lack of generics in mind, you can almost always avoid needing the
by ilovecaching 7y ago
As a Go developer, I rarely ever miss generics. If you design up front with interfaces and the lack of generics in mind, you can almost always avoid needing them.
- networkimprov 7y agoAnd when you finally get them, you'll wonder how you ever lived without :-)
- mcdee 7y agoYet having moved from (primarily) Java to (primarily) Go I find I don't miss them.
- Insanity 7y agoI had them (Java and C#) and I am happy Go does not have them. I feel like most people just miss them for collections and abuse them in other instances. And for collections Go has other tools (like generator if you really want to). Overall in the 2ish years of writing Go, I only missed them when I was learning the language coming from years of Java.
- erik_seaberg 7y agoWhen you need to switch from native maps to sync.Map, you not only have to give up type safety but rewrite all your calling code. Codegen doesn't help because you are not one of the people allowed to overload those operators.
- bobbylarrybobby 7y agoA bit like saying if you know you won’t have a hammer, you’ll instead bring a drill, a screwdriver, and screws. But sometimes it’s nice to be able to nail things together.
- bakul 7y agoIt is more that you code around the lack of generics. Interfaces: same API, different source code. Generics: different APIs, same source code. This is why Go needs to have generics.