Issue openned in https://github.com/golang/go/issues/40199.

Still clarifying my thoughts on embedding types within generics, will 
postpone this debate while I focus on other parts of the proposal and gain 
some more experience using the go2 branch. Not calling for any action here 
at this point. Thanks Ian. 
On Monday, July 13, 2020 at 7:03:35 PM UTC+2 Ian Lance Taylor wrote:

> On Mon, Jul 13, 2020 at 9:15 AM 'Javier Zunzunegui' via golang-nuts
> <golan...@googlegroups.com> wrote:
> >
> > In the context of Type Parameters - Draft Design#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). 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. 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?
>
> At least at first glance these just seem like bugs in the current
> implementation, not in the design draft as such. Would you mind
> opening an issue for these problems? Thanks.
>
> We could ban embedding type parameters, but our hope is to make
> generic types work as much like ordinary types as possible, without
> arbitrary restrictions. The existence of bugs doesn't in itself seem
> like a good enough reason to ban the feature.
>
> Ian
>

-- 
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/d8540f91-94b4-498f-97fe-606f956cea77n%40googlegroups.com.

Reply via email to