|
|
|
|
|
by tel
2047 days ago
|
|
Parameterized types can help here a lot. I didn't want to speak to them too quickly so I blurred a few lines, but it's a good point. Parametric types help with part (a) by allowing you to specify only part of the structure of your type. That can help enormously, though they also force some amount of concretion in your type which isn't always good. Ultimately, OCaml's module system is pointed in the direction of ad hoc polymorphism where you pass in behavior with your abstracted types. Subtyping supports this passing of behavior as it lets you specify a whole space of types abstractly. In that way, it's a little more supportive of the pathway to ad hoc polymorphism. |
|