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
Possibility of Nested Classes and Nested Inheritance?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-12-17 (01:32)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] Possibility of Nested Classes and Nested Inheritance?
From: "Jørgen Hermanrud Fjeld" <jhf@hex.no>

> I just read about the work by Nystrom, Chong and Myers on nested
> inheritance, specifically the article "Scalable Extensibility via Nested
> Inheritance".
> The article does demonstrate fascinating, to me, use of inheritance, and
> I wonder if it is possible to do something similar and
> object-oriented in OCaml.
> To do something similar would, according to my understanding, require
> both inner classes and super-class polymorphism.
> In understand inner classes as implicitly polymorphic with respect
> to the enclosing class,
> and polymorphism on the super class as the practical ability to extend
> the type hierarchy upwards.
> Do you know of any work that relate nested inheritance to OCaml, or that
> address the similar issuesof inner classes and super-class polymorphism?

Answer 1: there are no inner classes in ocaml.
Answer 2: there are plenty of other ways to obtain similar effects.

I don't know exactly what fascinated you in the paper, so it is hard
to answer precisely, but there are already a few techniques in ocaml to
solve the problems they describe.
(Of course they wouldn't cite them, as ocaml doesn't look like a
relevant language to them.)

Their compiler example seems to be a variant of the expression
There are several solutions to the expression problem in ocaml, using
either polymorphic variants
or objects

On the more general question of virtual types, Didier Rémy and Jérôme
Vouillon gave a detailed "refutation".

So you can see if you can do all what you need with the above methods.
If you find some unexpected limitation, please let us now.

Jacques Garrigue