Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Delegation based OO
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] Delegation based OO
From: Stefano Zacchiroli <zack@bononia.it>
> On Tue, Mar 23, 2004 at 10:14:02AM +0900, Jacques Garrigue wrote:
> > Note however that one needs to know more clearly which methods are to
> > be delegated, so I would rather favor a notation like:
> > 
> >  class does_more an_object = object
> >     delegate does_something to an_object
> >     ...
> >  end
> 
> Isn't enough to have a (closed) object type annotation for "an_object"?
> In this way you would now exactly the signature of the object to which
> you want to delegate without having to enumerate all of them.

Looks like there is a misunderstanding here: in Alex's example,
does_something was an object type. So yes, the above amounts to an
object type annotation, and declares simultaneously all the methods
included in the type.
The idea is to have something similar to variant dispatch
   function #super_a as x -> ... | #super_b as x -> ... | #super_c as x -> ...

Jacques Garrigue

-------------------
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