[–] mathgladiator 15y ago ↗ I 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.
1 comment
[ 2.8 ms ] story [ 14.5 ms ] threadfunction 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.