3 ms·
Your code in Go almost certainly does use generics. Just not user defined ones. I don't particularly want to argue the generic point as I believe it is beat t
by kasey_junk 11y ago
Your code in Go almost certainly does use generics. Just not user defined ones. I don't particularly want to argue the generic point as I believe it is beat to death. But I could use a good concurrent map in Go in dozens if not hundreds of places.
I could use a lock free ring buffer in dozens of places. I could use promise/futures in dozens of places. I could use anything but the big honking lock that is channels in dozens of places.
I could use proper variance rules in the generics Go does provide in dozens of places. I could use monadic style errors and options in dozens of places.
Now, I agree that I generally don't need to write my own generic code very often, but if the blessed generic writers on the go lang compiler team don't write these things for me, I don't have a fall back option in Go (other than code gen, which people are starting to fall back on). It just seems unsustainable to me.
- tptacek 11y agoThat's a fair point: the fact that Go seems to have a few hardcoded generics is one of the uglier bits of the language. I don't think Go is a great language, as I'm fond of saying, I just think it's a very useful tool.
- kasey_junk 11y agoBeen doing Go dev for over a year now, in a place where I can make the language decisions, so I clearly agree. But it being a good tool should not be a deterrent from it becoming a better tool. [edit] Edited to sound lest strident.