Browse thread
[Caml-list] Delegation based OO
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Correnson_Loïc <Loic.Correnson@t...> |
| Subject: | Re: [Caml-list] Delegation based OO |
This is a very interesting way of OO-programming.
More over, it allows to fullly benefit from multi-inheritance:
Suppose we have:
class type a = object ... end
class type b = object ... end
Then:
class a_and_b = object
delegates [classtype to] a ;
delegates [classtype to] b ;
end
I mainly found the requirement for such a delegation mechanism while looking
at GUI system, where classes have in general a *lot* of methods that must be
delgated by hand.
>From the compiler point of view, notice that such a delegation mechanism
would be concistent with the one already existing for modules (and
functors) thanks to the "include" statement:
module type A = sig ... end
module type B = sig ... end
module A_and_B(mA : A)(mB : B) = struct
include mA [ : A] ;
include mB [ : B] ;
end
>From an academic point of view, and looking for a beautiful symetry between
objects and modules, such an delegation-based OO system would be a nice
construction.
Loic Correnson.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners