On Sunday, July 31, 2016 at 11:46:28 PM UTC+8, bradfitz wrote:
>
> Interface values are comparable. If they have different concrete types, 
> they compare to false.
>
> See https://golang.org/ref/spec#Comparison_operators
>

I mean this:

> package main
>
> import "fmt"
>
> type IA interface {
>     A()
> }
>
> type IAB interface {
>     A()
>     B()
> }
>
> type IAC interface {
>     A()
>     C()
> }
>
> type T struct{}
> func (t T) A(){}
> func (t T) B(){}
> func (t T) C(){}
>
> func main() {
>     var t T
>     var a IA = t
>     var ab IAB = t
>     var ac IAC = t
>     
>     fmt.Println(a == ab) // true
>     fmt.Println(ac == ab) // error: mismatched types IAC and IAB
> }
>
 

>
>
> On Sat, Jul 30, 2016 at 10:33 PM, T L <tapi...@gmail.com <javascript:>> 
> wrote:
>
>> Is it essential?
>>
>> -- 
>> 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 <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to