Benefits of OCaml

Dynamic vs Static type checking

Here are some arguments in favour of dynamic typing:

Objection Explanation Rebuttal
Static type checking is stifling. The form of static type checking used by OCaml (derived from the Hindley-Milner type system) rejects some correct programs. If the programmer wishes to write such a program then it must be transformed into a program that is accepted by OCaml's type system before it can be compiled and run. The set of valid programs rejected by OCaml's type system is very small and most such programs are useless.
During development, it can be useful to run programs that are known to be type unsafe, particularly when the type errors are in parts of the program that will not be executed. OCaml prohibits the compilation of type unsafe programs. So all of the type errors in an OCaml program must be fixed by the programmer before the program can be run. Keeping a program type safe during development is not only easy in OCaml but is also good practice in general.
Static typing conflicts with macros. Some programming languages, most notably Lisp, provide a facility for extending the syntax of the language. With a Turing complete macro system, such as Lisp's, static type checking may never terminate. OCaml also provides a macro system, called camlp4. However, as OCaml has a much richer syntax than Lisp (e.g. built-in pattern matching), camlp4 macros are much less common than Lisp macros.
Static typing conflicts with run-time code generation. Run-time code generation introduces different stages of compilation. Static type checking done at an intermediate compilation phase is no longer done at "compile time". Most programs have no need for run-time code generation. Those that do, can use a custom interpreter instead, which will require a little more code and will run a little slower.
MetaOCaml is a research project that supplements OCaml with statically-typed run-time code generation. Run-time type testing is then removed where possible (giving MetaOCaml's run-time generated code the performance of OCaml).
Static typing conflicts with marshalling. A lack of run-time type information, makes it impossible to type check marshalled data. OCaml provides type-unsafe marshalling for the temporary storage of data. There are currently two different projects (HashCaml and MetaOCaml) that provide type safe marshalling in OCaml..
Static typing conflicts with generic printing. Due to the lack of run-time type information, it is not possible to implement a generic print function in OCaml. Printing is generally customised for different purposes anyway, so the overhead of having to write custom printing functions is not significant.
Compilers of dynamically typed languages like Lisp can still do static type checking. Much effort has gone into making the SBCL Lisp compiler perform static type checking, in order to report type errors earlier and improve performance. In order to gain the benefits of static type checking (particularly performance) it is necessary to design the language for static type checking. Although retrofitting static type checking onto a dynamically typed language can improve performance and error reporting, it will never be as effective as using a well-designed statically typed language like ML.