5 ms·
Out of curiosity, OCaml also has traditional classes/interfaces/objects, right? If so, then how do you decide when to use those versus module functors?
by daxfohl 10y ago
Out of curiosity, OCaml also has traditional classes/interfaces/objects, right? If so, then how do you decide when to use those versus module functors?
- willtim 10y agoAFAIK no one uses Objects in OCaml as the module system is sufficiently powerful. The Mirage project is a good example of using OCaml module functors to specialise components.
- yawaramin 10y agoModules and functors are able to contain type definitions, while classes/objects are not. This makes modules practically much more useful for abstraction.