OCaml isn't actually a pure functional language: it has side-effects and mutation. In fact, you can code that looks an awful lot like C if you want, except with automatic type inference. But then you can also lift up your level of abstraction in the same codebase to use a purely functional idiom where it's appropriate, or use an object-oriented style for something else. All of those styles are supported as consistent, first-class features in the language.
There are several event-driven programming libraries in OCaml, and two that I like that use monadic abstractions (to hide the messy control flow that makes node.js so painful) are Async (https://ocaml.janestreet.com/?q=node%2F100) and Lwt (http://ocsigen.org).
You have good low-level memory layout in OCaml, either via an FFI or the Ancient module to import in non-GCed values. You can read about the OCaml heap and GC at this blog series by Richard Jones. http://rwmj.wordpress.com/2009/08/04/ocaml-internals/ (and yes, the memory representation is a straightforward mapping from the type declaration; very little magic happens in the compiler)
OCaml is used all over the Xen Cloud Platform (http://github.com/xen-org/xen-api), and I'm running an ongoing microkernel research project called Mirage (http://www.openmirage.org) which has a full network stack written in pure OCaml (and is also competitive performance-wise).
Very cool, thank you. I watched the openmirage talk since I'm interested in distributed computing -- this is great work. I like anything that gets rid of excessive layers, and the typical cloud stack is really suffering from this.
I have been meaning to give OCaml a try for awhile but it's bumped on my list now. (Though it seems that the thing that people keep complaining about is lack of a polymorphic print...)
The biggest issue Ocaml has is that its GC is single-threaded which basically removes the ability to do parallel programming inside a single executable. You have to resort to message passing between multiple processes.
For what it's worth, I think I heard rumors there's work on an improved GC.
I'd add that Unicode support is also a problem. latin-1 isn't even good for French. My brother's name is Jérôme and the first thing I try with any language to check strings is this:
Oops, two characters didn't get properly uppercased.
I really like OCaml, it's probably my favorite language, and I hope that RWO will increase its popularity and that this will in turn help improve the language. I'm reading a lot about Haskell these because of the times when I want to do some multi-programming with unicode text.
I'm doing a project using Python on AppEngine. AppEngine forces you to use a bunch of single threads doing what is really message passing, but implemented in Python so it's slower than Ocaml.
I think this is going to turn out to be a killer feature of Ocaml once people get used to the fact that using 8 cores at once isn't that great of a goal when on-demand computing platforms let you scale much much larger. Pretty soon no one will be all that concerned about how much happens on any one machine. It will be how much gets done per process, and how much gets done per 'cloud'. AppEngine already does this.
And it already is a design feature. The GC is not single threaded b/c they're too dumb to figure out how to fix it (not that you were saying that, but people tend to jump to that conclusion). It's because they want the fastest possible single threaded performance, which means not polluting the GC with the kinds of locking mechanisms necessary to support multi-threaded operation.
I think this is going to turn out to be a killer feature of Ocaml once people get used to the fact that using 8 cores at once isn't that great of a goal when on-demand computing platforms let you scale much much larger.
I think this point isn't made often enough. There certainly are times when scaling within a single machine is useful but, as is more often the case, if you have to scale beyond a single physical instance you might as well plan for process-oriented parallelism up front.
Note that OCaml is just fine for heavy math and data stuff: the garbage collector has a global lock, but threads work just fine for CPU intensive activities. Just don't generate much garbage (which is important for any data-heavy processing), and all is good.
I've tried OCaml a few times over the years, and I think its biggest problems are chicken/egg problems. It's impractical for "real world" use because not many people are using it in the real world.
My biggest complaints:
* Poor libraries - This is getting better, but it used to be a real pain to do stuff like make an HTTP request, parse JSON or XML, or connect to a database. They definitely weren't in the stdlib, and it was even pretty hard to find good third party libraries for it.
* Awkward library interfaces - Even the libraries that are included are awkward to use, like the Set and Map.
* Poorly handled strong typing - For example '+' is used to add integers while '+.' is used to add floats. The underlying reason makes sense, but there's awkward stuff like that all over. Haskell handles it better, IMO.
The first three are indeed a big irritation, and a big motivation during writing this book. There is a lot of work going on to improve all of these at the moment, notably through Core from Jane Street providing a well-maintained accessible standard library, and a convergence of packaging systems. The good folks at OCamlPro are also working hard to better editor and documentation support, so I except there will exist a documentation/package repository before this book is released.
If they actually have event driven programming that seems like a big step over most functional languages, where I/O is kind of an afterthought.
Steve Yegge wrote some points about Ocaml quite awhile ago. http://sites.google.com/site/steveyegge2/ocaml He says it is quite fast and I've seen that in other places.
The thing I don't like about competing with C/C++ in "fast" is that those languages invariably are memory hogs. They hide that in the benchmarks.
Anyone know if you have control over memory layout in Ocaml? Or if you can reason about it like you can in C/C++?