From: Francois Rouaix <Francois.Rouaix@inria.fr>
To: Lyn A Headley <firstname.lastname@example.org>
Subject: Re: functors vs classes
Date: Tue, 20 May 1997 14:14:56 +0200
> In the caml programming language we are offered an (unprecedented)
> choice between two varieties of modular polymorphism, classes and
> functors. Each offers distinct advantages, and yet in a way it seems
> that each supports a different _style_ of programming. In my limited
> experience it seems that most people opt to focus on functors for
> their modularization needs, and make little or no use of the
> objective stuff. How do others see this?
A historical note:
Objects are pretty much orthogonal to the rest of the system, and were
only very recently made available in Caml. Functors are a bit older, and
also much more familiar in the ML community.
AFAIK, I use both functors and objects. I find objects most useful when
manipulating a (possibly complex) state through a set of (possibly recursive)
functions. This situation arises very frequently in the kind of code I'm
writing : lots of IO and threads.
Also, I got the impression that functors and inheritance are much more
useful when designing and writing a library than when writing an application.
Mes deux centimes,
This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:11 MET