There are some here problems where multiple inheritance is desirable, and easy unification of object types (the tagless — variant-less — subtyping) is very useful. The complex related properties and relationships among them are naturally representable with objects.
I’m trying to work out how to implement a similar concept with modules only. However, as @Chet_Murthy notes, the solution seems to converge to the use of some form of code generation (of which templates an instance).
Are there any serious arguments against the extensive use of ppx for these purposes? With records and relationships, a lot of the problem is indeed syntactic in nature, with the semantical part being the interface itself rather — something that is easily checked by a compiler.
Well, the OO is quite expressive. However, it seems to me that interestingly there apparently may exist an approach to dealing even with inheritance through the module level consructs (like functors). Yes, even with module system, there’s a significant problem space remaining to be solved somehow — and the solution thereby appears to be through some form of code generation or templating.
I suppose, if we could solve the following three problems without objects in a seamless fashion, then there would be an argument that objects are not really needed:
A natural representation of many distinct yet related records with overlapping record fields.
An implementation of visitors approach to data traversal.
A natural representation of interfaces to databases.
It is worth noting that F# has objects. I wonder, what is the level of performance of their implementation…
What is their relative memory consumption?
In principle, we could even store records, and instantiate objects referencing one or more records whenever a more sophisticated interface is desired, just as a special case optimization approach. Still, if the object data representation was compact enough… then even that wouldn’t be necessary.