The Go 1.27 interactive tour by Jesús Espino (Victoria Metrics) describes an improvement in the language that allows methods to declare type parameters.
“This is the headline of the release. A method declaration may now declare its own type parameters, independent of the receiver’s. Before Go 1.27, only top-level functions could be generic, so a generic operation on a type had to live as a package-level function instead of a method.”
The following example shows a findIndex implementation that expects only that the type of the... [More]