Hacker News new | ask | show | jobs
by ratorx 1555 days ago
Generics were originally not included because the Go designers felt that it was not necessary, and things could work without them.

Even though this opinion has changed, I don’t think it’s been completely reversed, just weakened. So I still think “Idiomatic Go” would be to avoid generics, except in some specific situations. To me, Generics feel like “smart code” in any situation except the most basic and the predominant mindset I’ve come across is that Go code should be dumb and easily understandable (if verbose).

I think the situation with TS is different. I also like TS (but haven’t used it as much), but tend to write different code with it than I would with Go. I don’t think there is any one clear winner and I find it more helpful to write code as expected for the language chosen, rather than trying to apply the ideas I loved from every language to every other one (as a user, obviously language implementors should be open to inspiration). Otherwise I would probably spend a significant amount of time poorly reinventing Rust Results in every language I use, which would temporarily confuse everyone else who read my code and not be as robust.