Hacker News new | ask | show | jobs
by geoka9 1652 days ago
It could be my personal negative experience with maintaining code that overuses generics in other languages, but I have reservations about this feature. I almost never need them, but on the other hand I don't feel too good about having to repeat myself when writing library packages.

I almost feel I would be happy with generics in Go if Go made them illegal in anything but libraries (not allowed in package main, maybe? Or not allowed in a package unless it gets imported by another package?).

1 comments

Yes generics / templates are mostly useful for general libraries. But if you afraid of programmers doing stupid things just for the fuck of it it is better not to hire such programmers, warn them if they're juniors or just hit them with the bat on code review.
That could be said about any language though? Yet here we are, arguing whether generics are good for Go, instead of just using Java.
>"That could be said about any language though"

Correct. Go is not special in this regard