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] productivity improvement
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-07-09 (12:46)
From: Basile STARYNKEVITCH <basile.starynkevitch@c...>
Subject: [Caml-list] productivity improvement
>>>>> "Oleg" == Oleg  <> writes:

    Oleg> What are the _simplest_ examples that demonstrate
    Oleg> considerable (> 2:1) O'Caml vs C++ productivity improvement
    Oleg> (in terms of program size) and where can I find them?

I am not sure the question does make any real sense. You might ask an
Ocaml vs Java comparaison, or an Ocaml vs Python compraison ....

1. Try coding the Ocaml compiler, the ActiveDVI viewer, the Unison
   synchronizer, or the Coq proof system, ... in C++, then tell us
   about your findings. If possible, publish your working C++ code :-)

2. The simplest example I can think of is the hello world program. In
   Ocaml it is just a single line:
      print_endline "hello world";;

   but in C++ you'll need at least an #include, then a main function,
   containing a out << "hello world" << endl statement perhaps a
   simplest even example is the empty program: (a 0 byte file in
   Ocaml, but in C++ you need a main function. the size improvement is
   infinite in favor of Ocaml)

Ok, my answer is silly, but I feel the question a bit silly too. More
convincing examples are the many existing (and publicised) code in
Ocaml. See the ocaml hump for instance, and more generally try ocaml
in a Web search engine. Also the Oreilly book (originally in French,
but translated in english) on Ocaml will help. There are lots of stuff
from too.

Both Ocaml and C++ requires a significant learning effort, however
(you might compare the volume of the language reference manuals; the
core language of C++ is much heavier than the core language of
Ocaml). Try coding some stuff in Ocaml and you will learn by
yourself. The type inference system is really a big plus.

Ocaml does have some minor weaknesses: the syntax is sometimes painful
(you could look into the Revised syntax proposal of D.deRanglaudre in
camlp4); mixing datatypes (eg records) and classes is painful; there
are much less libraries in Ocaml than in C or C++; metaprogramming is
not really easy; runtime information is almost inexistant; Ocaml has
no overloading, etc...

The real convincing examples would be projects which failed in C++ but
were resurrected and worked in Ocaml (I heard there are some such
projects but I cannot name them) but I am not sure you'll find public
references to failed projects.

N.B. Any opinions expressed here are only mine, and not of my organization.
N.B. Les opinions exprimees ici me sont personnelles et n engagent pas le CEA.

Basile STARYNKEVITCH   ----  Commissariat à l Energie Atomique * France
DRT/LIST/DTSI/SLA * CEA/Saclay b.528 (p111f) * 91191 GIF/YVETTE CEDEX 
phone:+33 1,6908.6055; fax: 1,6908.8395 home: 1,4665.4553; mobile: 6,8501.2359
work email: Basile point Starynkevitch at cea point fr 
home email: Basile at Starynkevitch point net

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: