1st: Says who? 2nd: The method set of a type would be stable at runtime since only instantiated methods would exist.
On Saturday, June 20, 2020 at 5:16:17 PM UTC+2, T L wrote: > > The method set of a type should be stable. Generic methods make this > impossible. > > On Saturday, June 20, 2020 at 9:31:53 AM UTC-4, Carsten Orthbandt wrote: >> >> 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/d76f3e53-d855-4f27-b21b-8a6f821dcbe6o%40googlegroups.com.