4 ms·
Interface comparisons check both, the value and the dynamic type. Describing that as "comparing vtables" is misleading. It the types don't match, the operands
by slrz 10y ago
Interface comparisons check both, the value and the dynamic type. Describing that as "comparing vtables" is misleading.
It the types don't match, the operands are not considered equal. Type and value have to match for two interface values to be equal. How does that not make sense?
For mismatched dynamic types you can't meaningfully compare the values in the general case, so of course you need to consider types.
- pcwalton 10y ago> Type and value have to match for two interface values to be equal. How does that not make sense? Because people expect == to compare values, not types. Nobody has ever questioned this behavior in Java and C#.