I've written this page beacause I've seen too many personal pages listing only
a few advantages of OCaml, thus giving an incomplete view. The official web page http://caml.inria.fr contains a detailed description.
OCaml is a high level functionnal programming language from the ML
family. It inherits a lot from several decades of research in type
theory, language design, and implementation of functional languages. It
also allows imperative and object oriented programming.
- freely available, open source,
- modern, type-inferring, with automatic memory management (Garbage Collector),
- reliable: no segfaults or buffer overflow (but you can disable
those tests for a small speed increase),
- as fast as C++, memory efficient,
- portable: write once, run just about anywhere!
- concise, programmes are quickly written,
- well-suited for teaching and academic projects, and growingly
used in the industry.
- strong type-checking and many safety features, many bugs are
detected at compile-time,
- powerful types, which can be combined (records, sums, cartesian
product), with polymorphism (better than templates) and recursivity,
- a toplevel evaluation loop: quickly test your functions without
bothering about input/output;
- three ways to be executed: you can either interpret it (use as a
script language, though still a bit heavier than shell or perl scripts), byte compile it (the virtual machine is available on
many standard platforms), or native compile it for efficiency,
- standard tools: doc generator, emacs-mode, debugger (rarely
needed because it's reliable!), preprocessor (camlp4, a very good one),
- a module system which allows large projects and separate
- a fast and efficient garbage collector.
- Not as many users as "big" languages, thus small library choice, but good interfacing to C, Perl and Java.
- language evolution decided by a small team
- small compatibility breaks between major versions
- GC not yet trying cache optimization (?)
- innovative objects system, could be disconcerting for Python, C++, Java, Eifell or SmallTalk programmers