Original post

Looks like generics are coming to Go at some point.

I’ve been reading through the draft here: https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md

It looks pretty straightforward. You declare type parameters, and give them constraints which are just interface types that arguments have to satisfy.

My question is, what kinds of code does this allow that isn’t currently possible?

I’m still fairly new to Go, and haven’t worked in a language that has generic types before, so there’s a lot to learn here.

Thank you!