News for hackers. Stuff that matters.
Re:Functional Programming in Go with Generics by nicoburns on Friday May 28, 2021 @05:38AM (#27313359)
> a generic type specification which is only required if the compiler emits the concretization instead of the programmer. (I'm ignoring interfaces as they aren't really relevant here, that I can see. And hopefully I'm using the right terminology here.)

Unless I'm mistaken, the "generic type specifications" are just interfaces. Instead of specifying the concrete type of a function parameter, you specify which interface it needs to implement, and then everything else is the same (except you may need to define getters/setters if you need access to struct fields). There's no need to have a new language primitive. That's certainly how Rust does it anyway. And given that Go's interfaces are structurally typed, it'll be even simpler in Go.

I don't really understand the argument that generics are complex. As far as I can see, they're super simple.

There are no comments on this comment yet.