Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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.

    -Didier