2 ms·
I think a lot of the people who wanted generics wanted them more to be like C++ templates, with compile time duck typing. Go maintainers were unwilling to go th
by cherryteastain 2y ago
I think a lot of the people who wanted generics wanted them more to be like C++ templates, with compile time duck typing. Go maintainers were unwilling to go that route because of complexity. However, as a result, any time I think "oh this looks like it could be made generic" I fall into a rabbit hole regarding what Go generics do and dont allow you to do and usually end up copy pasting code instead.
- wyufro 2y agoI think "oh this looks like it could be made generic" is the wrong time to convert to generics. You should convert when you reach the point "I wish I had that code but with this other type". Even then, sometimes interfaces are the right answer, rather than generics.
- deleted 2y ago[deleted]
- cherryteastain 2y agoI mostly agree, hence the > end up copy pasting code instead bit of my original comment