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
CLOS and ML?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 1999-08-12 (10:17)
From: Didier.Remy@i...
Subject: Re: CLOS and ML?
> I have been missing CLOS sooo much that I decided to give it a try in OCAML.
> It turns out that to first order, one can quite readily acheive multi-method
> dispatch using ML-like languages (see below...) Of course it would be far
> more convenient if this were an inherent part of the language. I have
> thought briefly about making a front-end that would accept an extended
> syntax incorporating some notion of multi-methods and having it translate to
> standard OCAML as a result. This would alleviate all runtime dispatching
> except for those cases where a possibly ambiguous data type is acted upon.

What you showed is one way to compile multi-methods in Ocaml, but you turned
off the type system by using dynamic types (implemented as variant types).
An ML user would expect some typechecking, so that in particular 'message not
understood' cannot arise.

> Is there any reason not to make CLOS-like behavior (e.g., STklos, CLOS,
> Dylan) in an ML language?

Typing CLOS-like objects and classes, including polymorphism, remains an
interesting topic for research.