English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2004-03-23 (09:02)
From: Stefano Zacchiroli <zack@b...>
Subject: Re: [Caml-list] Delegation based OO
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.

I find Alex idea really cool, delegation is a widely used technique in
OO programming but at the same time is painful to use because you have
to write the pattern:

  method foo = delegate#foo
  method bar = delegate#bar

Having to write

  delegate foo to delegate
  delegate bar to delegate

is not a big improvement, whereas writing

  class type delegate_type =
      method foo: ...
      method bar: ...

  delegate delegate_type to an_object

would really be an improvement.


Stefano Zacchiroli -*- Computer Science PhD student @ Uny Bologna, Italy
zack@{cs.unibo.it,debian.org,bononia.it} -%- http://www.bononia.it/zack/
If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. -!-

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