I see,

I guess the compiler error message needs improvement here. It could mention 
that interfaces with type lists cannot be used.

On Thursday, September 10, 2020 at 5:17:57 PM UTC+2 rog wrote:

> You can definitely use parametric interfaces in type assertion 
> expressions, but you can't use interfaces with type lists.
> I'm not sure exactly what you're trying to do in your example, but ISTM 
> that it could be somewhat simpler. You
> only need one type parameter: https://go2goplay.golang.org/p/4E0ZnVxJwL9
>
>
> On Thu, 10 Sep 2020 at 15:54, Viktor Kojouharov <vkojo...@gmail.com> 
> wrote:
>
>>
>> Would using parametric interfaces be allowed in type assertion 
>> expressions / type switches?
>>
>> The current behavior in the go2go playground is for the compiler to 
>> return the error: "interface contains type constraints (T)" (
>> https://go2goplay.golang.org/p/O1Un2Vm9Dh0)
>> I was under the impression that since the outer function is already 
>> parametrised with the same type, this should work without a problem.
>>
>> Perhaps I'm missing something, but I currently don't see how one can 
>> check for optional interface implementations of generic types, since this 
>> error will pretty much stop them.
>>
>> -- 
>> 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...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/fbe50aaf-1794-4a17-9321-2b923f546d13n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/fbe50aaf-1794-4a17-9321-2b923f546d13n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/10d006bf-2fa7-4d09-bcfc-1b9c0e0eb525n%40googlegroups.com.

Reply via email to