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

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f67fe5d8-21a2-4b13-ab04-2935f092d727n%40googlegroups.com.

Reply via email to