Re:Having fun with Go's nil, interfaces and errors
by slrz on Sunday September 18, 2016 @08:46AM
(#12525072)
Equality is not necessarily defined for values of different types ("with different vtables", if you will). You can't just compare values of different type and expect a meaningful result.
[ Parent
| on HN ]
Re:Having fun with Go's nil, interfaces and errors
by twic on Sunday September 18, 2016 @03:18PM
(#12526708)
In this case, though, we're talking about interfaces; an interface is a pointer plus this bit we're calling a vtable. Pointers, even to different types, absolutely can be compared for equality, can't they? More specifically, i am pretty sure pointers can be compared to see if they are both nil, which is all that would be needed here.