DEV Community

Discussion on: Go 2 Draft: Generics

Collapse
 
mindplay profile image
Rasmus Schultz

Yikes, the syntax is uglier than I had feared.

Parens for everything. Everything looks like a function call.

I guess if you take an ugly language and glob on more features, it can only get uglier.

IMO they should redesign the whole syntax to something more traditional. I’ve heard the argument that they designed the syntax so the compiler would be fast - I’ve always thought that was nonsense. Plenty of compilers with a more traditional syntax are just as fast or faster than Go.

I like the ideas of Go a lot. It’s a shame it has to be so hard to read...

Collapse
 
dean profile image
dean

I think that the idea is that it should look like a function call. So calling something like Sum(int) would be a "function call" that returns a func ([]int) int

I agree that it's a lot of parentheses in the definition, but hopefully type inference is good enough that the parentheses aren't needed much at the call site, if at all.