3 ms·
I hope that if this design is accepted they would also include some common generic types/algorithms in the standard library instead of leaving it to a 3rd party
by throwaway34241 7y ago
I hope that if this design is accepted they would also include some common generic types/algorithms in the standard library instead of leaving it to a 3rd party. For example an updated sync.Map (that doesn't use interface{}), some things from SliceTricks [1], or maybe the Set example (although I don't really have a problem with map[thing]struct{}, Set is arguably more clear).
IMO I think having a standard library that judiciously used generics would be almost pure upside for most Go programs. Being able to do math.Sin(x) instead of float32(math.Sin(float32(x))) just seems like an improvement in every way.
[1] https://github.com/golang/go/wiki/SliceTricks https://github.com/golang/go/wiki/SliceTricks
- weberc2 7y agoAgreed. I think this would go a long way toward addressing the original concern.