English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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 <erayo@cs.bilkent.edu.tr>
Comp. Sci. Dept., Bilkent University, Ankara
www: http://www.cs.bilkent.edu.tr/~erayo
GPG public key fingerprint: 360C 852F 88B0 A745 F31B  EA0F 7C07 AE16 874D 539C
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners