3 ms·
The common bias against structural typing is that there might be types with the same structure but subtly different semantics, e.g. coordinate systems. Same str
by beza1e1 15y ago
The common bias against structural typing is that there might be types with the same structure but subtly different semantics, e.g. coordinate systems. Same structural type, different semantic:
struct carthesian_coords { int x; int y; }
struct polar_coords { int r; int theta; }
- JoshTriplett 15y agoMost of the structural typing systems I've seen count the names of fields as part of the type, not just the types of the fields. So, those two structs would have incompatible types in such a system.