3 ms·
The problem with not having generics is the systems you build instead. They either throw away type safety and use reflection, which causes hard to debug issues,
by strken 5y ago
The problem with not having generics is the systems you build instead. They either throw away type safety and use reflection, which causes hard to debug issues, or they lean on code generation, which is slow and hard to debug.
I agree that the lack of generics only shows up once in a while and doesn't hamper productivity as much as might be expected, but I'm still very excited to see them added to the language.
- 1_player 5y ago> throw away type safety In theory yes, in practice if your Sort array function takes a list of interface{} instead of a well defined type is not going to cause any type bugs. Might be slow, might be ugly, but lack of types on functional/generic stdlib functions doesn't make your code buggier if the original implementation is sound.
- theshrike79 5y agoI'm cautiously optimistic about the addition of generics to Go. If all goes well, we'll get some nice stdlib stuff and 3rd party functions for handling different kind of data with a common api. But if the - you know what kind of people - discover it in earnest, we'll get a hellscape of C++ templating proportions when people go way overboard with it. Time will tell.