The Mercury Project |
|
|
Home
Related
|
MCORBA is a CORBA binding for Mercury.
It allows you to use CORBA
objects from Mercury, and allows you to implement CORBA objects in
Mercury. This means you can write distributed systems in Mercury,
or use Mercury to implement part of a component-based system.
Latest MCORBA News
Download MCORBAMCORBA is very much a work-in-progress, however we expect to soon have enough written so that you can start using it to develop applications. For the moment the most important thing missing from the binding is some of the generated C++ code. You can presently use the translator to see how IDL is transformed into Mercury.Download MCORBA: MCORBA is distributed under the GNU GPL for the translator, and GNU LGPL for the runtime library.You will need a copy of omniORB2, which you can freely download from the omniORB web site. Why use MCORBA?MCORBA allows Mercury programs to take advantage of existing components, acting as an interface between the Mercury system and an object. This means you can use exisiting components of software as part of a system, and Mercury will be able to easily communicate with them.It also means you can implement (or re-implement) components of a system in Mercury, and not need to worry about the concerns of the rest of the project. How does it work?CORBA objects can communicate with each other even if each object is implemented in different languages and running on different machines. This allows distributed systems to be created,To the programmer, communicating with a CORBA object is made as easy as possible, given the programming language that is being used. For Mercury, it is as simple as calling a method of a type class. Here is some Mercury code that reads input strings and sends it to a CORBA object.
:- pred sender_loop(T, io:state, io:state) <= chat(T).
:- mode sender_loop(di, di, uo) is det.
sender_loop(Chat0) -->
io:read_line(Res),
(
{ Res = ok(CharList) },
{ string:from_char_list(CharList, String) },
sendmessage(Chat0, Chat, String),
sender_loop(Chat)
;
{ Res = error(_Error) },
io:write_string("Some kind of error occurred\n")
;
{ Res = eof }
).
The type classes and their methods are generated from an Interface
Description Language (IDL). This language contains descriptions of the
data types that will be used in the system, and the interfaces to
various parts of the system. The implementation is left unspecified.
The IDL is transformed into a language specific binding, which allows each programming language to access things in a natural way for that language. For C++, IDL is transformed into classes with methods. For Mercury, IDL is transformed into type classes. |