Hello,
Consider the code below (taken from the Design Draft and slightly modified):
func ConcatTo[S Stringer, P Plusser](s []S, p []P) (r []string) {
r = make([]string, len(s))
for i, v := range s {
r[i] = p[i].Plus(v.String())
}
return r
}
It becomes immediately obvious that the set of parameters become slightly hard to read and could require a lot of editor help (via highlight, most likely) to distinguish between them. I'd like to propose that we separate the type and function parameters from the return parameters with a colon, so that the above code will become:
func ConcatTo[S Stringer, P Plusser](s []S, p []P): (r []string) {
r = make([]string, len(s))
for i, v := range s {
r[i] = p[i].Plus(v.String())
}
return r
}
With the colon, the parameters are easy to scan and don't require careful attention in order to make out the parts. More importantly, while the editor highlighting will be a good thing (and could greatly benefit from the presence of the colon), it doesn't become strictly necessary.
Regards,
Yaw