Pros and cons of OCaml
The advantages and disadvantages of the OCaml programming language.
Pros:
More powerful type inference than any other language: OCaml even infers union and class types!
Powerful module system lets you parameterize modules over other modules easily and safely with full compile-time checking and minimal run-time overhead.
Structural typing of modules, polymorphic variants and classes improves brevity, closing the gap with dynamic languages, but can obfuscate error messages.
Powerful integrated macro system lets you alter the language's syntax on-the-fly and write parsers quickly and easily.
Good serial performance from the x64 code gen.
Easy-to-use REPL.
Lots of high-quality tools and libraries.
Cons:
No overloading can make numerical code over many different types (e.g. complex numbers, vectors and matrices) tedious.
Poor multicore support means poor performance on today's computers.
Some basic functionality missing (e.g. no 32-bit floats, no
try
..finally
construct).Some basic functionality is very inefficient (e.g. 32-bit ints).
Poor floating point performance from the x86 code gen.
16MB limit on strings and arrays on 32-bit systems.
No way to override equality, comparison and hashing for new types and no way to catch errors created by this when the default structural versions are not applicable. Type classes are a solution to the former problem and equality types are a solution to the latter.
No value types means more memory use and worse performance in some important situations (e.g. filling a hash table with
float
keys and values in OCaml is 17× slower than F#).
Comments
Post a Comment