I have a question that this post doesn't answer: is the order of type parameters significant? Is there a canonical way, an idiomatic style for the order?
Example:
func Clone1[S ~[]E, E any](s S) S {
return append(s[:0:0], s...)
}
vs
func Clone2[E any, S ~[]E](s S) S {
return append(s[:0:0], s...)
}
The logic for inferring types plays out better for the first. Go limits the depth of searching for type inferences, to keep compilation fast/small/simple. Itβs always possible to be more explicit but nice to infer when calling generic code.
Example:
vs