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
[Caml-list] generic programming
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-10-15 (10:29)
From: Eray Ozkural <erayo@c...>
Subject: Re: [Caml-list] Re: generic programming
On Wednesday 03 July 2002 23:34, Alessandro Baretta wrote:
> Templates are "nasty" citizens of the C++ world. I've had
> *so* many problems tracking down bugs in code using STL
> templates. Basically, the "write once, compile many"
> strategy of C++ yields situations where the semantics of the
> algorithms coded in a template depends upon the type
> parameter you pass to the template itself. Abominable.
> Stick to Caml: "Write Once, Compile Once, Link Many".

Compared to Ocaml module system, C++ generics is a weakling. The use of 
template classes or functions is prohibitive with respect to compilation 
time, build size and code maintenance. On the other hand, the type system of 
ocaml combined with functors/structures makes generic programming a dream 
come true. I cannot think of a code in C++ that can abstract over a 
particular implementation of, for instance, a Set ADT well enough. Just *try* 
to write your own alternative set implementation for STL. :)


Eray Ozkural <>
Comp. Sci. Dept., Bilkent University, Ankara
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: