Language Complexity
The other day I wrote the following on Slashdot:
C++ is a complex beast of a language where features interact in extremly subtle and often pathological ways. You might not pay for the features you don't use in performance, but you often end up doing so in cognitive load.
I thought of it when I read this in a post by Sigfried Gonzi over at gmane.comp.lang.caml.inria:
I estimate the learning curve for Ocaml as big as C++.
Is this really true? Is it true only for people who don't know anything about functional programming to start with? OCaml is a large language, certainly, but I think what I said on Slashdot contains within it some truth. OCaml has a fairly orthagonal featureset, you can really do a lot of stuff without having to worry about the more complicated features. I don't think the same is true about C++, the more subtle aspects of the language will pop up and bite you whichever way you turn: You can't do "string1" + "string2" and the reason is somewhat technical. You can't create a simple operator without being aware of all sorts of copy constructor madness. The features of C++ might however be more orthagonal than OCaml's regarding performance interactions (while OCaml certainly beats Haskell in this department).
