Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: first class, recursive, mixin modules (was: RE: first class m odules)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-02-10 (19:24)
From: Brian Rogoff <bpr@b...>
Subject: RE: first class, recursive, mixin modules (was: RE: first class m odules)
On Fri, 9 Feb 2001, Claudio Russo wrote:
> > Cool! OK, now Alain has at least one example of a practically 
> > useful case
> > handled by your scheme :-). I suspect that this problem bites 
> > lots of ML 
> > programmers, and a fix is eagerly desired by at least two OCaml
> > programmers. Congratulations on making this work, the millenium is
> > starting off on a great note already!
> I'm not really sure it bites that many, but I'd like to be told
> otherwise.

I'd be very surprised if it hasn't bitten a very large fraction of people 
who've used ML seriously for any length of time. I actually presented a 
sort of "solution" in Mosml using recursive modules but the problem is 
that of wanting a recursion between a type declaration and a functor 
instantiation. I've actually noticed quite a few mails from programmers on
this topic. 

> It does really hit you when trying to implement Chris Okasakis elegant 
> bootstrapped data structures, or emulate object oriented things with 
> modules.

It's close to something OO, the "Composite" pattern, but it is not a 
particularly OO concept. Many hierarchical structures have a leaf/hier 
relationship and as soon as you try to reuse the Set functor or 
a signature in the type definition of the composite you get slapped. 

In the faux-ML code I wrote, you could switch representations of the 
collection with a single line change. It is a bit verbose, but I 
prefer it to the parameterization trick, which requires that I change 
the library to get additional polymorphism. 

-- Brian