Articles

Will Faught

April 2022

Generics For Go

A design that adds generic functions and types.

(Obviously for Go 1.17.) Why you might find this approach interesting: Type variable declarations are implicit Type arguments for functions are implicit Type variable constraints can be omitted for the empty interface Methods can be generic Operations are represented with generics as normal methods It can simplify the Go language specification Check out the More ideas section at the end for things beyond generics. Define comparison operations for all types For the types that don’t yet have them:

design generics go languages technology types

Will Faught

28 minutes

π