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
Instruction selection in the OCaml compiler: Modules or classes?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-23 (16:13)
From: brogoff <brogoff@s...>
Subject: Re: [Caml-list] Instruction selection in the OCaml compiler: Modules or classes?
On Thu, 22 Feb 2007, Joel Reymont wrote:
> The slides seem to favor the class-based solution but then I hear
> that classes in OCaml are slow and people like Markus Mottl just
> plain despise them :-). What does everyone else opine?

It's one of the most interesting issues in the OCaml language design.

There is a lot of overlap between the module system, the object system,
and to some degree, records. One would think that a language design with
fewer features could provide the same powers of parameterization, but
modules aren't first class (and the recursive module extension is still
an "experimental" feature) and don't support inheritance, records in
OCaml are rather weak, and classes don't have type components.

I use classes less frequently (but as Markus points out they are for the
most part much more pleasant than Java or C++ classes) so my gut feeling
is that their abilities should be subsumed in the module system (mixin
modules?) and the record system. But that will probably be a new
language, ML2040, given the current rate of change of ML :-(.

-- Brian