News for hackers. Stuff that matters.
Re:Why Generics? by iainmerrick on Wednesday July 31, 2019 @04:29PM (#20578173)
Right, I see this as the biggest benefit.

Go already has generic built-in maps, channels and slices, so clearly those generic types are useful.

If what I actually want is a multiset, say, it would be great to have a standard library class that looks and behaves similarly to map except it’s a multiset, rather than just having to use map and do all the little 1- and 2-line boilerplate tricks for the multiset operations. I can write shorter code that more clearly expresses my intentions, and reduce the risk of stupid little bugs in the boilerplate.

There are no comments on this comment yet.