Hacker News new | ask | show | jobs
by reificator 2930 days ago
When discussing whether go has generics, "plain go" is a reasonable thing to say.

Besides it's a compiler. It's going to take an input in format X and translate it to an output in format Y. That's just what they do. Syntactic sugar debates aside there's still no generics in there.

1 comments

"generics" is mostly a matter of type system, not of implementation - as Java and this Go implementation showcase. Indeed, "untyped" generics is trivially implementable in Go, via `interface {}`, you just loes all the type safety (and you have to write more verbose code).

My point is, Go type system DOES support generics, but only for "primitive" types, not for user-defined types.