Hacker News new | ask | show | jobs
by coldtea 1652 days ago
>My first response when the plan to add generics was announced was “meh”. In my 5+ years working in Go, I can probably count on one hand the number of times that I felt like I really needed generics.

And then the author goes to admit that they had written a whole library with the kludge that is textual code generation "to support both primitive and custom types".

1 comments

Something I don’t often see mentioned in these discussions about generics: generics as a feature is massively important for library authors, not so much for library users. So of course if you’re mostly spending your time writing business logic and web APIs you don’t encounter the need for generics that often. But when you try to write for example a library for a data structure while keeping some type safety (so not relying on interface{}), you absolutely need generics.