Is OCaml's standard library its weakest link?

In this post I read that:

OCaml’s standard library is one of its weakest parts. Always use extensions to the std library.

Searching around the net I find ExtLib, Batteries, and Janestreet.
I’m not sure what “weakest link” meant in the original post so I will leave it wide open for any concerns that people have. Perhaps it means that it does not have enough functionality? Or slow? Or there is something odd about the APIs?
It is true that OCaml’s standard library is its weakest link?

8 thoughts on “Is OCaml's standard library its weakest link?”

  1. OCaml’s stdlib isn’t nearly as comprehensive as those of, e.g., Java and Python, and hasn’t grown or changed much over the last few major versions. It has a couple of minor design flaws (e.g., commonly used List functions that are not tail-recursive, missing OrderedType implementations for several builtin types) that will probably never be fixed. To compound the problem, as you point out, there are several major “alternative” stdlibs (though the Extlib developers recommend Batteries for future development, IIRC).

  2. It is horrible. I can’t even rely on it to sort because the sorts stack overflow even on arrays.
    Basically I end up using very little from the stdlib.

  3. As I understand it, the so called standard library of OCaml is designed for OCaml’s own development. And it is intentionally kept small.
    About non tail recursive functions: this is also a compromise. I can find links about it, but I think that for “small” lists, which are often used, non tail recursive functions are faster?
    OCaml developers stated that they don’t have enough resources in order to maintain a full-feature standard library: they hope from good one to emerge from the community.
    You quoted most of them. Maybe, in the future, the community will have them converge? Or take care to avoid incompatibilities?
    I personally don’t use them. But certainly should…

  4. For better or worse, I develop a lot of web apps. Programmers have been coming to web development from different sorts of background: unix command line programmers, mainframe “green screeners”, Win32 desktop programmers. What they all have in common is that they don’t know the “unwritten standards” for how the web works.
    If you asked the average “book smart” programmer to implement urlencode() and urldecode() correctly, they’ll probably do it wrong; there are just enough details that you’ll probably miss one (urldecode() in PERL is still wrong after all of these years!)
    Database connectivity is another big area of anxiety. Just because there’s a db driver listed on the Camel’s hump doesn’t mean it’s a good database driver. I’ve seen serious bugs persist for years in Oracle’s official drivers for certain platforms. If you’ve got good database drivers for a platform, it’s easy to get spoiled, but an off-brand database, an off-brand driver or an off-brand platform can cause all sorts of headaches.
    One of the reasons why PHP is so popular is that it has “good enough” implementations of most of the things that you need to do to build webapps.
    I’ve often thought about doing small projects in oCaml, but the lack of trusted libraries to do lots of stupid little things that are on my fingertips in the languages I use everyday discourages me.
    Now one of these days I might do a hacking project in F#, since F# has a good interface with the .NET universe (much better than Scala’s interface with Java)

  5. Once I started to learn OCaml, but I was quickly put off by the awful list functions which are not tail-recursive.
    Come on, how hard can it be to copy Extlib’s implementation and get rid of that stupid stack-overflow-prone lib?
    How can I trust a language implementation that concatenates lists using a non-tail recursive algorithm?
    To be honest, in a language that is meant to be fast, I would expect an imperative algorithm, optimized in assembly! (not in the first release, but in a mature language, some kind of optimization is expected).
    I find hard to believe that the current implementation (non-tail-recursive) has any advantage over an imperative version. If I’m mistaken, I would really like to hear from the language implementers.
    If F# corrects this mistakes (and it seems it does), it’s going to be a great language. But I would like to see OCaml improve too, correcting those mistakes that have been forever in the stdlib. I really wonder why they don’t do that.

Leave a Reply

Your email address will not be published. Required fields are marked *