On Mon, Jul 13, 2020 at 9:15 AM 'Javier Zunzunegui' via golang-nuts
<golang-nuts@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/CAOyqgcVpAp5pSRRJmYCN4KquKwKQ8-OJ_QALbTUE4JCckdc%3Dww%40mail.gmail.com.

Reply via email to