4 ms·
Why don't more languages use Structural Subtyping?
- mathgladiator 16y agoI wrote a language that did structural sub typing, and I found it kind of encouraged stupid errors. For instance, function ZeroOut(Point2D p) { p.x = 0; p.y = 0; } Now, Point3D p3d = { x = 1, y = 2, z = 3 }; ZeroOut(p3d) is poorly defined. It does what I ask, but not what I want it to do. My intent and implementation did not match up. This is one of the reasons I just gave up on static types and object orientated programming; it requires too much damn boiler plate code.