News for hackers. Stuff that matters.
Re:Go generics are not bad by tsimionescu on Saturday July 09, 2022 @01:43AM (#32032155)
Sure, but it's no longer generic, you're just using runtime types again.

This is extremely important, because it means `func (someType[T any]) foo(T x) T`, `x.foo(1)` would return `any`, not `int` like a generic function would.

In fact, if you're going to instantiate a generic type parameter with `any`, I would very much doubt you wanted a generic type in the first place.

There are no comments on this comment yet.