To Learn MoreCommunication between distant Objective CAML programs can be rich.
Use of text protocols is greatly facilitated by utilities for
syntactic analysis (see Chapter 11). The persistence
mechanism offered by the Marshal library
(see Chapter 8) allows sending complex data in
its internal format including
functional values if the two communicating programs are the same.
The main deficiency of that mechanism is the inability to send
instances of classes. One solution to that problem is to use
an ORB (Object Request Broker) to transmit objects or
invoke remote methods. This architecture already exists in many
object-oriented languages in the form of the CORBA
(Common ORB Architecture) standard. This standard from
the OMG (Object Management Group), which debuted in
1990, allows the use of remote objects, and is independent of
the implementation language used to create classes.
The two principal functions of CORBA are the ability to send objects to a
remote program and, especially, the ability to use the same object
at many locations in a network, in order to call methods which can
modify its instance variables.
Further, this standard is independent of the language used to
implement these remote objects. To that end, an ORB furnishes
a description language for interfaces called IDL (Interface
in the manner of CAMLIDL for the interface between
Objective CAML and C.
For the moment, there is no ORB that works with Objective CAML, but
it is possible to build one, since the IDL language
is an abstraction of object-oriented languages with classes.
To simplify, CORBA furnishes a software bus (IIOP) that
allows transferring and addressing remote data.
The ability to reference the same object at
many points in a network simulates distributed shared memory,
which is not without problems for automatic garbage collection.
The ability to reference a remote object does not cause code to be
transferred. One can only receive a copy of an instance of a class if
the class exists on the server. For certain client-server applications,
it may be necessary to use dynamic loading of code (such as in Java applets)
and even to migrate processes along with their code.
An interesting example of dynamic loading of remote code is the
MMM browser built in Objective CAML by François Rouaix:
This browser can be used conventionally to view Web pages,
but can also load Objective CAML applets from a server and run them in a graphical