In the context of Type Parameters - Draft Design#generic-types <https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#generic-types> :
Type embedding is allowed in the proposed generic changes. Oddly, the current implementation allows for calling methods in the embedded types but not using the method to satisfy an interface (here <https://go2goplay.golang.org/p/fOJIhgnbOxC>). That seems like a bug in the implementation. More significantly, it allows for calling not just the methods declared in the interface, but also methods available to the instantiated type but not part of the interface. Example here <https://go2goplay.golang.org/p/bHDUMUzee2d>. I can't see what is the gain in allowing that, and it presents a risk as the interfaces satisfied by types originating from the same generic type will differ not only in the types of the methods, but also i the method names themselves. Would it not be best to not allow embeding in generic types? -- 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/007aa3e3-5ae8-4385-83dd-5f7246565db3n%40googlegroups.com.