Objects and Modules

CamlORB uses a two-layer mapping for objects, like in LablGTK.

low-level mapping

CORBA object references are represented by values of the type -'a obj, an abstract type with a contravariant type parameter. The inheritance relations betweens interfaces are reflected in the type parameter. Operations and attributes are regrouped in caml modules. CORBA modules are also mapped to caml modules.

object layer

On top of the low-level mapping, a caml object layer wraps the operations on object references. This object layer is however "flat" : CORBA modules are reflected in the class names, not by caml modules.


This is a (somehow) simplified example of how CORBA interfaces and modules are mapped.

IDLlow-level mappingobject layer
module A {
  interface Foo {
    attribute long bla;
    void aa();

  interface Bar : Foo {
    long bb();
module A = struct
  type foo = [ `foo ]
  module FOO = struct
    val _get_bla : [> foo] obj -> int
    val _set_bla : [> foo] obj -> int -> unit
    val aa : [> foo] obj -> unit

  type bar = [ `bar | foo ]
  module BAR = struct
    val bb : [> bar] obj -> int

class type foo't : 
    val _obj : 'a obj
    constraint 'a = [> foo]
    method as'foo : foo obj
    method _get_bla : unit -> int
    method _set_bla : int -> unit
    method aa : unit -> unit
class foo : [> foo] obj -> foo't
val foo : 'a obj -> foo

class type bar't : 
    inherit foo't
    val _obj : 'a obj
    constraint 'a = [> bar]
    method as'bar : bar obj
    method bb : unit -> int
class bar : [> bar] obj -> bar't
val foo : 'a obj -> bar