The #golang proposal to introduce generic functions and types (via parametric polymorphism) has been evolving nicely. This 🧵 summarizes what the latest is:

- [] sqr brackets to be used for type param
- type param must have a constraint
- constraint `any` will be new keyword
Use type constraints to define the set of types that can satisfy type arguments
Example: defining and using a generic function
Types can be constrained by behavior by specifying a list of methods that must be implemented by the type argument
Constraints can be more restrictive by specifying both a type list and a method list
Beside functions, types can be defined as being parametric
Example: using a generic type
You can follow @VladimirVivien.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: