2 ms·
I can only remember three cases in our codebase (30+ microservices) where we suffer without generics: 1) we have to write many duplicate functions just to chec
by kgeist 5y ago
I can only remember three cases in our codebase (30+ microservices) where we suffer without generics:
1) we have to write many duplicate functions just to check if an element is inside a slice
2) slices are not covariant, so we have many duplicate functions just to convert something like []MyObject to []MyInterface
3) we have to resort to using slices/maps for most data structures, it's mostly good enough, but the intention is less clear (for example, using a map for a set, or a slice for a queue) and it's less performant than more specialized data structures
Looks like most of it will be covered by the new slices package and various third-party collections packages which are going to proliferate.
We don't use 1.18 in production yet however, because of poor tooling support yet (including linters).