Mixed Organisations
The last example of the preceding section showed the advantages that
there are in mixing the two models for the problem of the
extensibility of components. We now propose to mix parameterized
modules and late binding to benefit from the power of these two
features. The application of the functor will produce new modules
containing classes which use the type and functions of the
parameterized module. If, moreover, the signature obtained is
compatible with the signature of the parameterized module, it is then
possible to re-apply the parameterized module to the resulting module,
thus making it possible to construct new classes automatically.
A concrete example is given in the last part of this book which is
dedicated to concurrent and/or distributed programs (page
??). We use a functor to generate a
communication protocol starting from a data type; a second functor
permits us to then deduce from this protocol a class which implements
a generic server which handles requests expressed in the protocol.
Inheritance can then be used to specialize the server into the
service that is actually required.