Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

about syntax of generic #39811

Closed
cossbow opened this issue Jun 24, 2020 · 2 comments
Closed

about syntax of generic #39811

cossbow opened this issue Jun 24, 2020 · 2 comments

Comments

@cossbow
Copy link

cossbow commented Jun 24, 2020

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") }

@mvdan
Copy link
Member

mvdan commented Jun 24, 2020

Please read the draft first. This is very explicitly discussed there.

@mvdan mvdan closed this as completed Jun 24, 2020
@cossbow
Copy link
Author

cossbow commented Jun 25, 2020

Sorry!

@golang golang locked and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants