[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Francois Rouaix <Francois.Rouaix@i...> |
| Subject: | Re: functors vs classes |
> 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, --f