I really hope generics, like reflection, are only used when there isn't a simpler option. I honestly would have preferred and had more use for sum types.
I like the square brackets though. They look right for Go and it is more readable.
I really hope generics, like reflection, are only used when there isn't a simpler option. I honestly would have preferred and had more use for sum types.
I like the square brackets though. They look right for Go and it is more readable.
blessed implementations inside the language, slices, maps and channels are built in generics.
sync.Map is what the standard library version looks like. It loses type safety.
It's incredibly great that, generally speaking, if I'm looking at Go code, the only kind of hashtable there can possibly be is the Go map data structure. The only kind of blocking queue there can possibly be is the Go chan data structure.
You will never see a LinkedTreeDeque or whatever other bizarre concoction someone might come up with. And people don't feel obligated to make every API an iterator of some kind.
Go makes being generics architecture astronautics impossible, and I really love that about it. Perhaps that makes me basic, but I am basic and happy.
They are not "bizarre concoctions".
They are so sufficient you need to learn all these tricks by heart in order to do basic operations on slices: