3 ms·
I haven't looked at go beyond doing the tutorial, so what follows isn't a learned opinion. The interface system in Go covers most of what you would do with gen
by stonemetal 13y ago
I haven't looked at go beyond doing the tutorial, so what follows isn't a learned opinion. The interface system in Go covers most of what you would do with generics, if you use interfaces your code is generic. The only friction over a generics implementation is the way you wire up types to interfaces.
- minamea 13y agoSomeone correct me if I'm wrong, but I think that's true only if you use methods and not operators, because Go doesn't support operator overloading.
- 4ad 13y agoThat's correct, which means stonemetal's comment is true only for non-math code, but 99% of the code out there is not math.
- stonemetal 13y agoThe other place you really feel the lack of generics is in the collections. They are built around the empty interface so that they can hold any type. Then you have to cast back to what you want. Exactly like Java pre generics. ugh.