You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm very concerned about the generics of golang.
I have a small proposal to use angle bracket < > to identify generic parameter types, which has a higher degree of variability than parenthesis (), making it easier to read the code. func PrintSlice(type T)(s []T) { for _, v := range s { fmt.Printf("%v ", v) } fmt.Print("\n") }
vs func PrintSlice<type T>(s []T) { for _, v := range s { fmt.Printf("%v ", v) } fmt.Print("\n") }
The text was updated successfully, but these errors were encountered:
I'm very concerned about the generics of golang.
I have a small proposal to use angle bracket < > to identify generic parameter types, which has a higher degree of variability than parenthesis (), making it easier to read the code.
func PrintSlice(type T)(s []T) { for _, v := range s { fmt.Printf("%v ", v) } fmt.Print("\n") }
vs
func PrintSlice<type T>(s []T) { for _, v := range s { fmt.Printf("%v ", v) } fmt.Print("\n") }
The text was updated successfully, but these errors were encountered: