Hi!

First, thanks to the Go team for the hard work and the list populace for an 
extremely low-noise list. Very much appreciated.

In the recent draft, struct methods with type parameters are explicitly 
excluded with a note that they might be added later.
I think I roughly understand the added complexity of having basically 2D 
type parameters (from the struct type itself and the mehtod).
However, and I'm really wondering why nobody brought this up, I think this 
is a language element that would be quite akward to add later.

Not because syntax would have to change in incompatible ways, but because 
idiomatic Go will be forced to steer towards global functions for this use 
case.

Minimal example:
https://go2goplay.golang.org/p/CxK7EuhW_fF

Please note that the struct type in this example does not even use type 
parameters.

With the method receiver really being just a 0th argument to a method, I 
don't see why having type params on methods would be such a big challenge.


Best Regards,
Carsten
 

-- 
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/aa570653-56e4-492e-8640-4d4434cd2973o%40googlegroups.com.

Reply via email to