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 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 mvdan commented Jun 24, 2020

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

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

@cossbow cossbow commented Jun 25, 2020

Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.