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 (01:14)
From: Jacques Garrigue <garrigue@k...>
Subject: Re: [Caml-list] Delegation based OO
From: Alex Baretta <alex@baretta.com>

> Away from politics and back to the ordinary stuff...
> This allows us to extend the functionality of CLASSES. What about 
> extending the functionality of objects?
> class *type* does_something = object ... end
> class does_more (an_object:#does_something) = object
>    delegates an_object
>    ...
> end
> This is very important to me because in my code I often use the concept 
> of proxy-object.

Interesting idea. It would be even more useful now that one can define
immediate objects (without explicitely defining a class).
And recent changes on the implementation make direct delegation
very cheap in terms of code size.
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

which clearly would get the same type.
As always the main trouble is that it requires a new keyword...

This is worth considering.

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