I like the direction the Go generics design draft has been heading in. There are however a few aspects that I feel could potentially be nicer so here's a design sketch/outline that attempts to address those. It maintains the spirit of the existing design, just frames it in a different way.
- Any type may be used as a constraint for a type parameter. This is analogous to how any type may be used to constrain ordinary non-type function parameters. See (4) for details.
- Type lists in interfaces are not part of this design.
- Sum types are added to the language, along the lines of Roger Peppe's proposal.
- There are three possibilities for type constraints: